-->
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.  [ 7 posts ] 
Author Message
 Post subject: How to do multiple left join
PostPosted: Mon Jun 04, 2007 2:51 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
Hey,

i need to do multiple left outer join, but if i do it more than twice i get an exception.

As i understand if i have a bag mapping i cant do left join more than two times.

I dont want to use set or list with index in the mapping , so how can i solve this problem?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 04, 2007 3:30 pm 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Hi,

I would suggest you check out the @CollectionId (the documentation says it is ONLY EXPERIMENTAL) annotation, as using this with "bags" means you can join/fetch multiple bags in a single query.


Cheers,

Andy

_________________
Rules are only there to be broken


Top
 Profile  
 
 Post subject: But, if you use collection id its means that you are working
PostPosted: Mon Jun 04, 2007 3:43 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
with order list and in my case i dont need order list.
i dont want extra column in the DB.

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 2:46 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
If you do not want to use Lists with the @IndexColumn annotation, Sets, or "bags" (Collection or Lists w/o @IndexColumn) with out the @CollectionId, you have 2 options:
    1) Split the query into sections where each section will not cause the "Cannot fetch multile bags" exception, and perform each seperately.

    2) Use a Native Query and then map it back onto the entities.

If you don't want the schema modified then I would probably go with option 2, as option 1 will be slow.

Cheers,

Andy

_________________
Rules are only there to be broken


Last edited by andydale on Fri Jun 08, 2007 2:48 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 11:52 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I would probably go for a Set though
As for the EXPERIMENTAL mark, since it hasn't change for ages, then you can consider it non experimental :)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 2:47 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Emmanuel,

Thanks for the infomation regarding the @CollectionId annotation, i can start using it without any worries at the back of my mind :-) When will the Javadocs be updated ??

Cheers,

Andy

_________________
Rules are only there to be broken


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 10:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Ah I remember now, I'm not happy with the generator delcaration
But it's either gonna stay the same or be changed with @GenericGenerator();
so the migration will be smooth

_________________
Emmanuel


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