-->
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: fetch query with aliasToBean
PostPosted: Wed Oct 15, 2008 2:00 pm 
Newbie

Joined: Tue Nov 01, 2005 2:00 pm
Posts: 10
Hibernate version:3.2.5
MySQL 5.0.45

Hello All,

I am trying to retrieve a list of objects and its many-to-many association in a single query. I can get the results I want with this :

Code:
select distinct(inf) from Info inf left join fetch inf.descriptors ds


But, I would really like to use the aliasToBean ResultTransformer to get the data in the format I need.

Code:
select inf.id as id, inf.owner.userName as owner, inf.platform.name as platform , inf.base.name as base, inf.site.name as site, inf.srcIncluded as srcIncluded, inf.compressed as compressed, inf.location as location, inf.hostName as hostName, ds.descriptor as descriptors from Info inf left join inf.descriptors ds


The problem is that I can't use left join fetch because I am not retrieving inf itself and this gives me a single descriptor for each bean ... so, no descriptor collection.

How can I get this as a collection for this query?

TIA


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.