-->
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.  [ 2 posts ] 
Author Message
 Post subject: when merge, proprety entities are destroyed
PostPosted: Thu Feb 23, 2006 8:49 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
Two entities, Picture and Person, ManyToOne

Class Picture {

....
@ManyToOne
public Person getOwner() {... }

}


Picture picture = <a detached entity>
// the picture has a owner that is an instance of Person(not CGLIB enhanced).
//change picture name, then merge
Picture p = em.merge(picture);

The owner(Person) of p is changed to a CGLIB enhanced instance, and its all member variables become null. It has an Initializer that says initialized=true.

Why is that? I expected the object returned from em.merge() would keep all the data.

One thing I do not understand:

em.create(entity) will change entity directly. For merge, why it return a different instance? which instance should I work on after merge?

Thanks for help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 11:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
your debugger does not give you accurate infos apparently, if you do getProperty() you'll get the infos

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.