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
|