Hi i have hibernate mapping like this class name="com.example.Company" table="user">
Code:
<many-to-one
class="com.example.Organization" fetch="join"
name="consumer" lazy="false" >
<column name="ORGANIZATION_ID" />
</many-to-one>
<many-to-one
class="com.example.Organization" fetch="join"
name="supplier" lazy="false">
<column name="ORGANIZATION"/>
</many-to-one>
Before save update my database is something like this
company table
Code:
COMPANY ORGANIZATION_ID ORGANIZATION State
1 4 NULL Active
organization table
Code:
id name
4 xxxx
now my problem is i set the state of company to deactive and saveupdate company table
company.setstate(deactive)
saveorupdate(company)
after save update companynew organization with id 5 is geting created and assigned to company table
company table
Code:
COMPANY ORGANIZATION_ID ORGAIZATION
1 4 5
organization table
Code:
organizationid name
4 xxxx
5 nulll
i want the compnay table as it is.I am using 2 organization for different context.
I want something liek this after saveupdate
Code:
COMPANY ORGANIZATION_ID ORGANIZATION State
1 4 NULL deactive