-->
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: session.saveOrUpdateCopy changes the FKs instead of copy its
PostPosted: Thu Aug 19, 2004 4:36 pm 
Newbie

Joined: Mon Aug 09, 2004 2:50 pm
Posts: 10
Location: Sao Paulo , SP, Brazil
Hibernate version: 2.1.6

Mapping documents:
<class
name="com.tesla.cvrd.vap.modules.normatizacao.entity.FluxoTransporte"
table="D82FRMTT"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="D82IDFLU"
type="java.lang.Integer"
unsaved-value="0"
>
<generator class="sequence">
<param name="sequence">D82FRMTT_S00</param>
</generator>
</id>

<set
name="estadiaVagaoCargaDescarga"
table="LPFESTAT"
lazy="true"
inverse="false"
cascade="all"
sort="unsorted"
>
<key column="LPFIDFLU" />
<one-to-many class="com.tesla.cvrd.vap.modules.normatizacao.entity.EstadiaVagaoCargaDescarga" />
</set>

</class>


Why the method saveOrUpdateCopy create a new object with new PK, but changes the FKs in one-to-many relations instead of copying all objects from all collections that are in the main object ?

In the class FluxoTransporte I have a Set of EstadiaVagaoCargaDescarga, and when I copy a FluxoTransporte object with session.saveOrUpdateCopy( fluxoTransporteObj, newId ), Hibernate create a new FluxoTransporte object (ok at this moment) but it change the FKs (FluxoTransporte PK) in the EstadiaVagaoCargaDescarga table instead of to create new objects with the new PK.

Thanks for any help,

Sergio Stateri Jr.
sergio.jr@tesla.com.br


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.