-->
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: Detached collection modification
PostPosted: Thu Oct 28, 2004 10:24 am 
Regular
Regular

Joined: Fri Sep 03, 2004 2:01 pm
Posts: 51
Hibernate version:2.1.6
Name and version of the database you are using:Oracle 9


Have I missed some fundamental mapping concept here, or is Hibernate completey incapable of dealing with modifications to detached objects that contain collections (like most object graphs) ?

I have a web app, domain/data objects loaded on the EJB tier using Hibernate. I have to detach the object graph in order to serve it to the web tier (which renders lazy loading unusable in this very common scenario).
Once on the web tier, the client users make changes to the data in various collections and objects. This modified object is sent back to the EJB, where I attempt to reattach the instance with a new Hibernate session and persist the data - a very common scenario, no rocket science here.

However, Hibernate never stores the collections correctly (properties yes, collections, no) - I always end up with duplicate rows in the DB since it cannot detect the change, (since the Hibernate-wrapped collections can be swapped out on the GUI tier).
Even when I ensure that the Hibernate-provided wrapped collection stays around, emptying that collection (.clear() ) and then repopulating it with the new data values always ends up with duplicate key violations.

What have I missed here?


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.