• Post Reply Bookmark Topic Watch Topic
  • New Topic

Differecne between proxy and lazy attributes in <class> for hibernate hbm file  RSS feed

sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An object proxy is just a way to avoid retrieving an object until you need it. Hibernate 2 does not proxy objects by default. However, experience has shown that using object proxies is preferred, so this is the default in Hibernate 3.

Object proxies can be defined in one of two ways. First, you can add a proxy attribute to the class element. You can either specify a different class or use the persistent class as the proxy. For example:

<class name="Location"
The second method is to use the lazy attribute. Setting lazy="true"is a shorthand way of defining the persistent class as the proxy. Let's assume the Location class is defined as lazy:

<class name="Location"lazy="true"...>...</class>

From the above mentioned comments, i want to know the difference between lazy="true" and proxy attribute when the proxy object is same as the class object

Also could somebody guide me with an example when the class object and the proxy object are different.
I want to know the structure difference between a class object and its proxy object
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!