-->
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: composite-id and many-one
PostPosted: Thu Jul 29, 2010 12:03 pm 
Newbie

Joined: Thu Jul 29, 2010 11:24 am
Posts: 1
From documentation and hibernate test suite i see that it must be possible to use a composite-id key column as the column in a many-one property.
For instance something like this:
<class name="Order" table="CustomerOrder">

<composite-id name="id"
class="Order$Id">
<key-property name="customerId" length="10"/>
<key-property name="orderNumber"/>
</composite-id>

<many-to-one name="customer"
column="customerId"
insert="false"
update="false"
not-null="true"/>
</class>
<class name="Customer">

<id name="customerId"
length="10">
<generator class="assigned"/>
</id>

....
</class>
</hibernate-mapping>

I have a legacy database with no foreign key relations defined ! Can this be the reason that i get this exception? org.hibernate.MappingException: Repeated column in mapping for entity ....(should be mapped with insert="false" update="false").
For collection mappings (i found), no foreign keys relations at the database level is no problem!

Thanks in advance


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.