zoukankan      html  css  js  c++  java
  • Hibernate 中的 lazy=”proxy” 和 lazy=”no-proxy” 的区别

    精妙的例子

    Child   <-   many-to-one   ->Parent   
      class   Child   {   
          private   Parent   parent;   
        
          public   Parent   getParent   (){   
              return   this.parent;//访问了实例变量   
          }   
            
      }   
        
      class   Parent   {   
          private   String   name;   
        
          public   String   getName(){   
              return   this.name;//访问了实例变量   
          }   
          public   void   f(){   
              System.out.println("invokeing   f()");//没有访问实例变量   
          }   
      }   

    如果   many-to-one  

    的lazy设为proxy,当child.getParent().getName()或child.getParent().f()时,parent都
    会被抓取,若设为no-proxy,调用child.getParent().f()时,parent是不会被抓取的,同时这种方式需要编译时字节码增
    强,否则和proxy没区别。

    @Copy of this post、《此帖为bing拷贝》

  • 相关阅读:
    MySQL性能优化的最佳经验
    18个网站SEO建议
    sql之left join、right join、inner join的区别
    PHP与MYSQL事务处理
    Firefox上Web开发工具库一览
    SphinxSE的安装
    python XML
    python yaml
    C语言文本处理
    Linux strace命令
  • 原文地址:https://www.cnblogs.com/Zhangmin123/p/5839856.html
Copyright © 2011-2022 走看看