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: re-persist deleted entity : need to clean id of entity
PostPosted: Thu Aug 02, 2007 6:44 am 
Newbie

Joined: Thu Aug 02, 2007 6:23 am
Posts: 1
I'm working on a client/server app in jboss ejb3.

If i want to undo a deletion of an object, i call em.persist(o), where o used to be a detached instance, but has been em.remove(o) in an earlier transaction.

This persist() invocation gives the "passing detached instance to persist" because hibernate thinks the thing is still detached (probably because the deletion of that entity did not affect my remote detached entity in the client app, but i do use that detached remote entity to persist again).

So to make this work, i have to clear the id of my entity: by doing that, hibernate no longer thinks the entity is detached, and accepts the persist(), and generates new ids.

The problem is, that the entity is actually a tree of entities.

What i'm looking for, is some method that clears the ids of my entity and all related ones, following the cascading rules for persist.


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.