-->
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: save update create new row in table
PostPosted: Mon Mar 14, 2011 10:43 am 
Newbie

Joined: Mon Mar 14, 2011 10:35 am
Posts: 1
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


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.