the design principles and code analysis of hibernate lazy loading

来源:互联网 发布:如何打开电脑端口 编辑:程序博客网 时间:2024/06/06 04:24

as we all know,Hibernate is already one of the most popular ORM frameworks. and its performance is key highlight .when we use ORM framework,there will be a lot of convertions between  objects and database tables.if it can be handled well,it will make this framework extremely cumbersome. hibernate provides  many fabulous functionalities .or example  lazy loading. an domain object associates collections or another domain object, when initialition ,domain object will default not load collections and object entity. only when on demands.so it can impove performance.

what are the design principles of lazy loading?

well,proxy pattern is the core principle. for colletion mapping,like set,map ,list etc ,in hibernate codes,there are PersistentSet,PersistentMap,PersistentList classes to implement these interfaces.for associated collection,Hiberate will using CLGIB,JAVAASSIST create an proxy  object to represent collection,it actually not load during the creation of the object,only needs it load them.


原创粉丝点击