This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Lazy loading not possible for persistent classes marked final

 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to hibernate framework and I cam to know that, The persistent class should not be final because if it is final then lazy loading cannot be used by creating proxy objects.
I just wanted to know reason behind it, or any link where I can find the reason behind it.
Thanks in advance
 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following are excerpts from the book Java Persistence With Hibernate, chapter13, topic 13.1.6 Lazy loading with interception


Runtime proxy generation as provided by Hibernate is an excellent choice for transparent lazy loading. The only requirement that this implementation exposes is a package or public visible no-argument constructor in classes that must be proxied and nonfinal methods and class declarations. At runtime, Hibernate generates a subclass that acts as the proxy class; this isn’t possible with a private constructor or a final entity class.


Hope this helps
 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Naresh
This really helped me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic