-->
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: composite-id
PostPosted: Tue Jan 30, 2007 5:46 am 
Newbie

Joined: Tue Jan 30, 2007 4:57 am
Posts: 2
Hello,
I have read docs and forum on how to setup Master-Detail with composite id and the only way we got it working is to use composite-element on the detail object, but this is kind restrictive, we could have problems in future to reference it and querying.
I got all kind of errors as i tried different variation to the code below: often tells to use "insert or update=false" but then if i do it says "not allowed in the key element", other cases try to do an update instead of an insert, others try to insert but you can see the master_id is null...
what is wrong with the config below?

Thank you.


Hibernate version: 3.2.2.ga

Mapping documents:

<class name="Root" table="root">
<id name="id" type="long">
<generator class="sequence">
<param name="sequence">seq_root</param>
</generator>
</id>
<version column="ver" name="ver" type="long" />
<property name="myprop" type="string" />
......
<joined-subclass name="Master" table="master">
<key column="master_id " not-null="true" />
<property name="myname" type="string"/>
<bag name="details" cascade="all" order-by="row_num">
<key column="master_id" not-null="true" />
<one-to-many class="Detail"/>
</bag>
</joined-subclass>
</class>

<class name="Detail" table="detail">
<composite-id>
<key-property name="mId" type="long" column="master_id" />
<key-property name="numRow" type="int" column="num_row"/>
</composite-id>
<property name="mydesc" type="string" />
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 8:07 am 
Newbie

Joined: Tue Jan 30, 2007 4:57 am
Posts: 2
nobody has ideas/solution?


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.