-->
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: problem in Many to Many with composite key
PostPosted: Mon Nov 23, 2009 11:21 pm 
Newbie

Joined: Mon Nov 23, 2009 10:11 pm
Posts: 1
Hi,

I have a problem in setting the many to many relationship with composite keys.
I have two tables namely "PARTY" and "GROUP". These tables have a relation of many to many. So there is an association table "GROUP_PARTY".

In "PARTY" table (partyId and versionId) -> composite key
In "GROUP" table (GroupId and VersionId) -> composite key
In "GROUP_PARTY" table (partyId,GroupId,VersionId) -> composite key

In group.hbm.xml file i have set the many to many as :

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Group" table="SHAPE_GROUP">
<composite-id name="groupPK" class="GroupPK">
<key-property name="groupId" column="GROUP_ID"/>
<key-property name="versionId" column="VERSION_ID"/>
</composite-id>
<property name="groupName">
<column name="GROUP_NAME" />
</property>
<property name="createdBy">
<column name="CREATED_BY" />
</property>
<property name="createdDate">
<column name="CREATED_DATE" />
</property>
<set name="parties" table="GROUP_PARTY">
<key>
<column name="GROUP_ID"/>
<column name="VERSION_ID"/>
</key>
<many-to-many class="Party">
<column name="PARTY_ID"></column>
<column name="VERSION_ID"></column>
</many-to-many>
</set>
</class>
</hibernate-mapping>

But it didnt work.

Can you please suggest me a workaround for this problem.

Thanks and Regards
kavitha


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.