-->
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: Custom result object problem LazyException eager fetching
PostPosted: Wed Jul 07, 2010 5:56 am 
Newbie

Joined: Wed Jul 08, 2009 4:48 am
Posts: 4
Hi,
is there a way to get some lazy child objekts into the Constructor of an custom query result object?

SELECT new foo.CustomItem(c.name, c.address) from Customer as c join fetch c.address as a

- Without fetch I get an LazyException when using the item.
- With fetch I get the Exception "query specified join fetching, but the owner of the fetched association was not present..."

So what can i do?
thank u
rené


Top
 Profile  
 
 Post subject: Re: Custom result object problem LazyException eager fetching
PostPosted: Wed Jul 07, 2010 9:12 am 
Newbie

Joined: Wed Sep 24, 2008 12:48 pm
Posts: 6
Unfortunately you can't. There has been a jira open for this issue for quite some time. I can't remember the number, but the last time I checked it didn't look like it would be fixed any time soon.


Top
 Profile  
 
 Post subject: Re: Custom result object problem LazyException eager fetching
PostPosted: Wed Jul 07, 2010 9:24 am 
Newbie

Joined: Wed Jul 08, 2009 4:48 am
Posts: 4
okay, thank you.

Than there is only the way to read the lazy addresses In the constructor with adr.getId().
Again, the ugly n+1 sql problem... ;-(


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.