-->
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.  [ 2 posts ] 
Author Message
 Post subject: Join fetch returns only 1 object in set
PostPosted: Mon Jul 16, 2007 8:16 am 
Beginner
Beginner

Joined: Tue May 08, 2007 8:26 am
Posts: 21
I am executing the following query (minimized):

Code:
Machine machine = (Machine) getSession().createQuery(
          "from Machine m" +

          //other query stuff

          " left join fetch m.things t" +
          " join fetch t.thingType" +
          " left join fetch t.others o" +

          //other query stuff

          " where m.machineId = '"+ machine.getMachineId() +"'" +
          " order by m.machineName").uniqueResult();


Now when I execute this, all goes well... except that "things" is supposed to be a set with 3 objects in it.
Instead it only has 1 object in it (the first one encountered in de database).
Same goes for "others", that only has 1 object.

I've searched a bit but can't find a solution for this, anyone knows what I am doing wrong?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 16, 2007 8:41 am 
Beginner
Beginner

Joined: Tue May 08, 2007 8:26 am
Posts: 21
Ok i found out why.
Further down the "tree" inside the database, I had some normal join fetches, but if I put a left join instead it works for some reason.
Don't know why since there are values populated for all the tables down the tree.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.