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?