-->
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: question for batch fetching
PostPosted: Thu Jun 30, 2005 9:16 pm 
Beginner
Beginner

Joined: Tue Apr 12, 2005 9:15 pm
Posts: 24
I am using hibernate 3 and I am trying to get the following behavior with batch fetching.
My classes:
I have an object graph where :
Object A has Set of Object B
Object B has Set of Object C

I have batch-size set to 20 for all 3 classes of object A,B,C. And I have not set lazy on the class - so, by default it should be true.

Now within my session, I do a get for object A, then I do a A.getBs to initialize the collection B for A. But, now I want to iterate through the objects in collection B and lazy initialilze ONLY some of them for Collection C based on property value on object B. Is this possible?

What I am seeing the behavior is even though I iterate through the Collection B and do B.getCs only for some of the Bs, it initializes ALL of the Bs with collection C. When I turned on debug for hibernate, I see that the batch loading is happening and a prepare statement is created with obids of ALL Bs for
DEBUG Loader:1456 - batch loading collection: [B.ClassC#<15402, 15439, 15443, 15447, 15451, 15455, 15510, 15684, 15688, 15692, 15415, 15419, 15423, 15427, 15431, 15435>]
DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 1)
DEBUG AbstractBatcher:324 - select ClassC ......


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.