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: How to fetch collection eagerly by using a separate select
PostPosted: Tue Sep 29, 2009 7:35 am 
Newbie

Joined: Tue Aug 26, 2008 12:18 pm
Posts: 9
Hello,

I can't find out an answer to very simple question:
How to fetch collection eagerly by using a separate select, if I want to use Criteria query.

I would expect, that this code should do it, but it doesn't work.

Code:
DetachedCriteria crit = DetachedCriteria.forClass(Parent.class);
crit.setFetchMode("children", FetchMode.SELECT);
crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);


In spite of the fact, that in doc of FetchMode.SELECT is writen: "Fetch eagerly, using a separate select.", collection of children isn't eagerly fetched and I still recieve LazyInicializationException.
Thanks in advance.

_________________
Arguing on the Internet is like running in the Special Olympics.

Even if you win, you’re still retarded. :P


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.