• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help needed hibernate fetching strategy

 
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic