-->
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: set one-to-many with composite-id fails
PostPosted: Tue Aug 23, 2005 4:27 am 
Beginner
Beginner

Joined: Wed Jul 20, 2005 2:57 pm
Posts: 28
Hi,

I don't know how to make a set to an other class where the target columns are in a composite-id class. The source are the columns leagueid,name which are equal to leagueid,teamname in the child-class. Can anybody give pointer please?

my mapping for the "parent-class" looks like this:
Quote:
<hibernate-mapping package="hibernate">
<class
name="Team"
table="team"
>
<composite-id name="pk_team" class="PK_Team">
<key-property
name="leagueid"
column="leagueid"
type="java.lang.Long"
/>
<!-- the following name represents the teamname-->
<key-property
name="name"
column="name"
type="java.lang.String"
/>
</composite-id>
<set name="Team_Player" inverse="true" cascade="all">
<key column="leagueid"/>
<key column="teamname"/>

<one-to-many class="hibernate.Player"/>
</set>

...
</hibernate-mapping>



and the mapping of the "child-class" looks like this:
Quote:
<hibernate-mapping package="hibernate">
<class
name="Player"
table="player"
>
<composite-id name="pk_player" class="PK_Player">
<key-property
name="leagueid"
column="leagueid"
type="java.lang.Long"
/>
<key-property
name="teamname"
column="teamname"
type="java.lang.String"
/>

<!-- the following name represents the playername-->
<key-property
name="name"
column="name"
type="java.lang.String"
/>


</composite-id>
...
</hibernate-mapping>


I get the Exception that the content of elemet set does not match...


Thanks in advance, Kurt


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.