-->
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: one-to-many and join left fetch
PostPosted: Fri Mar 18, 2005 10:06 am 
Newbie

Joined: Fri Mar 18, 2005 9:37 am
Posts: 1
Hibernate version: V2.1

When i execute the following query :

Code:
Query q = hSession.createQuery(
   "from TabHistorique as TabHistorique " +
   "left outer join fetch TabHistorique.tabHistoriqueservices "
);
eTAB_HISTORIQUEs  = q.list();


where tabHistoriqueservices is a one-to-many set of TabHistorique it return tabHistoriqueservices*TabHistorique number of row ?

I have to redo
Code:
eTAB_HISTORIQUEs = hSession.find("from TabHistorique");
to have the correct number of line in the list and exploit it.

All work well, the List is correct and one-to-many accessible without database access but is there a solution to do this in one pass ?

Thx to all.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 18, 2005 8:41 pm 
Beginner
Beginner

Joined: Mon Mar 14, 2005 6:07 pm
Posts: 36
Try Query q = hSession.createQuery("from TabHistorique"), and add outer-join="true" to the definition of tabHistoriqueservices collection in the TabHistorique's mapping file.


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.