-->
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: Recovering from a rollback; version field not rolled back
PostPosted: Tue Jul 29, 2008 3:32 am 
Newbie

Joined: Tue Jul 29, 2008 3:08 am
Posts: 1
Hibernate version 3.2.4.sp1
I use EJB 3, jboss 4.2.2. ga,
Hibernate EntityManager and Annotations 3.2.1GA

Hello,

I'm newie to hibernate. I use a @Version annotated field.
I'm trying to recover from a rollback. Something very easy, the user forgot a not null value on the entry form. So, an error is thrown from database so i let the user to correct the error and save again.

I have a master object and a child one (oneToMany relation), the user forgot a non-null value on the child object.

The problem is that after the rollback, because of the null value on the child object, the master object has adquired a new version number. So recover the object graph with a merge operation on a new session fails with the stale object message. If i correct the versioned number to its last value, all is fine.

I have read discussions of similiar problems when recovering from rollbacks with the generated ids, and read hibernate 3 rollback ids to avoid such problems when recovering from transactions fails. (unable to reattach objects)

So, i have to do recover version numbers manually? Or Am I missing something? It does not sound reasonable to manage version number manually because a) the object graph can be deep and b)if i have not misunderstood hibernate 3 rollback ids, so why no to rollback version numbers?


Thanks in advance


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.