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????
|
|