This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes Lazy loading of single association in hibernate... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Lazy loading of single association in hibernate..." Watch "Lazy loading of single association in hibernate..." New topic
Author

Lazy loading of single association in hibernate...

Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello!

I have many-to-one relationship between Answer to Topic:

I specified FetchType.LAZY to have topic entity to be loaded only when it is requested. Unfortunately when I do get :

Topic is always fetched in another select by this get method. Hibernate generates two selects - for answer and for topic when this method is called.
Topic is retrieved as hibernate proxy as it should be for lazy loading but why at the same get method?

How to tell hibernate not to select topic entity when doing hibernat get of answer entity?

Thank you!


True person is moral, false is right!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lazy loading of single association in hibernate...