-->
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.  [ 4 posts ] 
Author Message
 Post subject: Changing of composite key
PostPosted: Fri Aug 27, 2004 4:38 am 
Newbie

Joined: Wed Aug 25, 2004 10:54 am
Posts: 12
We can't change bad legacy db design but must implement modification of composite keys. Personally I am not working on this segment, but we cannot make it run (screams "key changed" when updated). Is there something bad in the mapping? This class and table are only many-to-many substitution and because of additional parameters we need to have that class and access the table.

Thanks

Rimmer


Hibernate version: 2.1

Mapping documents:
Code:

<class
    name="net.buildercom.admin.hibernate.Torganizationuser"
    table="TORGANIZATIONUSERS"
>

    <composite-id name="comp_id" class="net.buildercom.admin.hibernate.TorganizationuserPK">
        <key-property
            name="fuserid"
            column="FUSERID"
            type="java.lang.Long"
            length="10"
        >
        </key-property>
        <key-property
            name="forganizationid"
            column="FORGANIZATIONID"
            type="java.lang.Long"
            length="10"
        >
        </key-property>
    </composite-id>

...

    <!-- Associations -->
    <!-- derived association(s) for compound key -->
    <!-- bi-directional many-to-one association to Torganization -->
    <many-to-one
        name="torganization"
       class="net.buildercom.admin.hibernate.Torganization"
       update="false"
       insert="false"
   >
       <column name="FORGANIZATIONID" />
   </many-to-one>
   
    <!-- bi-directional many-to-one association to Tuser -->
    <many-to-one
        name="tuser"
       class="net.buildercom.admin.hibernate.Tuser"
       update="false"
       insert="false"
   >
       <column name="FUSERID" />
   </many-to-one>
   
    <!-- end of derived association(s) -->


</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 27, 2004 4:45 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
by definition, the declared id (composite or not) cannot be updated.

does your app need to do it?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 27, 2004 5:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use JDBC.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 27, 2004 5:33 am 
Newbie

Joined: Wed Aug 25, 2004 10:54 am
Posts: 12
Unfortunately, demanded functionality needs to change id elements (in more places than this example) so JDBC is now the only solution:(

Thanks for help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

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.