-->
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.  [ 3 posts ] 
Author Message
 Post subject: Better way to initialize a set?
PostPosted: Fri Jul 14, 2006 12:28 pm 
Newbie

Joined: Fri Jul 14, 2006 12:25 pm
Posts: 2
This is probably an easy one, but is there a better way to initialize a set instead of having to iterate through the entire collection and initialize each element?

Ex (from my DAO)

Set rp = remixPool.getPool().getExhibit().getDeal().getBillingEvents();

Iterator iter = rp.iterator();

while(iter.hasNext())
{
BillingEvent be = (BillingEvent) iter.next();
Hibernate.initialize(be);
}

We close the session since it's a webapp, so unless I take this approach I get the lazy load error.

Thanks, Graeme.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 14, 2006 2:17 pm 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
You could use an HQL query

something like:
Code:
select
   billingEvent
from
   RemixPool remixPool
   left outer join remixPool.pool
   left outer join pool.exhibit exhibit
   left outer join exhibit .deal deal
   left outer join fetch deal.billingEvents billingEvent
where
   remixPool = :remixPool


Top
 Profile  
 
 Post subject: Excellent thanks
PostPosted: Fri Jul 14, 2006 4:21 pm 
Newbie

Joined: Fri Jul 14, 2006 12:25 pm
Posts: 2
Thanks.


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

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.