-->
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: Efficient way of retrieving 2nd collection?
PostPosted: Thu Jul 30, 2009 6:56 am 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
I've got a query which loads a number of Tracks and their associated File objects. The query goes like this:

Code:
from Track t left join fetch t.files where t.album = :album


That's all fine, and it executes in no time. Now, i've got a second collection in my Track objects which is
called keywords. This collection contains Keyword objects for each track.

If i choose to use Hibernate.initialize() on the tracks returned by my last query, this will as usual issue a new
select statement which uses an IN statement on the original query. The problem is that this takes time.

My question is: is there any other way of "manually" initialising the keywords collection on my Tracks?

It would be really easy to issue a fast select statement which retrieves the Keyword objects needed; but is there any way of
"associating" these manually retrieved objects with the Track collections without breaking up or disturbing all the background checking that Hibernate does?


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.