-->
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 of Using Same column name as PK and FK on Two tables
PostPosted: Tue Jun 05, 2007 11:32 pm 
Newbie

Joined: Wed Jan 31, 2007 9:55 pm
Posts: 16
I have two tables Order and OrderAlloc

Order
====
Order_Id (PK)
Trade_Date (PK) <=========
xxxxx

OrderAlloc
=======
Alloc_Id (PK)
Trade_Date (PK) and (FK) <=========
Order_Id (FK)
xxxxxx


Here's the mapping file for OrderAlloc:

<composite-id name="id" class="OrderAllocsIdVO">
<key-property name="allocId" type="string">
<column name="ALLOC_ID" length="15" />
</key-property>
<key-property name="tradeDate" type="date">
<column name="TRADE_DATE" length="7" not-null="true" />
</key-property>
</composite-id>
<version
name="version"
column="version"
type="long"
/>
<many-to-one name="FXOrder" class="OrderVO"
fetch="select" insert="true" update="true">
<column name="ORDER_ID" length="15" not-null="true" />
<column name="TRADE_DATE" length="7" not-null="true" />
</many-to-one>

The problem is that
1. if insert="true" update="true", it complaints with with repeating columns

2. if insert="false" update="false", will insert null value of Order_Id on Table Order_alloc. It's expected as Order_Id won't be included on the insert/update statement.

Therefore, how to solve this on Hibernate?

Thanks!


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.