-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Does Hibernate.initialize() populate the 2nd level cache?
PostPosted: Mon Jul 20, 2009 8:24 am 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
I've got a tree structure made up of the entity TreeNode. The TreeNodes maps a a parent TreeNode and a collection of child TreeNode objects. All properties are set to lazy.

What i do is that i'll load the TreeNode for which the parent property is null (this is the topmost node). Then i recursively iterate the children of this TreeNode (and every TreeNode further down in the hierarchy) and use Hibernate.initialize() to load the children. This naturally issues a number of database queries; which is fine.

However; whenever repeat the above process, i get just as many database queries. So, my question is then; does the Hibernate.initialize() put the elements it loads into the second level cache?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.