Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lazy loading of single association in hibernate...

 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic