-->
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: many-to-many without a join table (using a formula instead?)
PostPosted: Wed Jun 14, 2006 7:09 am 
Newbie

Joined: Tue Jun 13, 2006 11:11 am
Posts: 3
Hi,

Is there any way to create a many-to-many mapping without a join table. Just to make something up by way of explanation, something like

Code:
<set name="users" formula="select u.id as user_id, g.id as group_id from .....">
            <key column="group_id"/>
            <many-to-many column="user_id"/>
</set>


Sure, I could make a view to provide the join table. But is there any way I can do it using just hibernate mapping markup.


Thanks very much,
Mike.

PS This is a more succinct restatement of http://forum.hibernate.org/viewtopic.php?t=960708


Top
 Profile  
 
 Post subject: from docs
PostPosted: Fri Jun 23, 2006 9:28 am 
Newbie

Joined: Tue Jun 13, 2006 11:11 am
Posts: 3
<join>
<key column="employeeId"/>
<subselect>
select employeeId, orgId
from Employments
group by orgId
having startDate = max(startDate)
</subselect>
<many-to-one name="mostRecentEmployer"
class="Organization"
column="orgId"/>
</join>


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.