-->
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 KEY Problem
PostPosted: Thu Jun 16, 2005 9:55 am 
Newbie

Joined: Fri Jun 10, 2005 6:30 am
Posts: 4
Location: Bangalore,India
Hi Guys,

I have been using Hibernate for couple of months now......Now I have a problem inserting data into the DB.

Say I have a Table called Billing ..The Keys in this table being

1-Billing Id(Primary)
2-Billing Number(Not Null)
3-Vendor Id-(Foreign Key)
4-Summary Account(FK)

Contents of table Vendor

1-Vendor-Id(Primary)
2-Vendor Desc(Not Null)

Contents of Account

1-Vendor-Id(Foreign-From Vendor table)
2-Summary Accont(From Billing Table)
3-SummaryDesc(Not Null)

When U generate the HBM Billing.....U would have a Many to One Relationship with Vendor table & Account table like this

<many-to-one name="vendorAccount"
class="XXXXX.VendorAccount"

>

<column name="VENDOR_ID" />

<column name="SUMMARY_ACCOUNT_NO"/>

</many-to-one>




<many-to-one
name="vendor"
column="VENDOR_ID"

class = "XXXXXXX.Vendor"
/>



Now say u want to store a instance of Billing onto Data base....It generates a error message saying "Vendor Id"..Duplication row..Coz in Billing HBM vendor Id occurs twice...So we put insert='false' & update='false'....Now the question How do I update the Account table thru Billing????


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.