This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

help needed hibernate fetching strategy  RSS feed

 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on hibernate fetching strategies but unable to get the difference. I do not know where I am doing a mistake. I am using MySQL5.0 as DB.

I have an Author class and a Books class. The relationship is One to many. I query the books and retrieve the author one by one but I am not able to see the select query for each author for each book from the list obtained after executing the query. This is the default fetching strategy but I am not able to see the query but able to print the properties of the author.

I have added the following two properties in the hibernate.cfg.xml. Are there any other property which needs to be added for sql logging apart from the below.



I am hereby attaching the code for more details.

Books.hbm file

Author .hbm file




In the client code
 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silly mistake :-) was trying to perform outside the session.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!