-->
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: Long running nested transactions
PostPosted: Mon Aug 23, 2004 11:23 pm 
Newbie

Joined: Mon Aug 23, 2004 11:01 pm
Posts: 1
What would be the best approach for implementing long running nested transaction support with hibernate? Long running transactions prevent the use of JDBC based nested transactions using rollback as connections are being re-used between different hibernate sessions due to pooling.

E.g.

1 create hibernate session
2 start txn A
2 objX.setName("Bob")
3 start txn B child of A
4 disconnect session
5 reconnect session
6 objX.setName("Steve")
7 abort txn B
8 disconnect session
9 reconnect session
10 commit txn A

Result objX.name == Bob

It seems as if using FlushMode.NEVER and cloning a session using serialization might provide the ability to do a logical 'rollback' to simulate the desired behavior. Something like...

1 create hibernate session A
2 objX (in scope of A).setName("Bob")
3 make hibernate session B clone of A
4 disconnect sessions
5 reconnect sessions
6 objX (in scope of A).setName("Steve")
7 close session A (without flushing)
8 retrieve objX in scope of session B
9 update references to objX in A to use objX in B (ouch!)
10 flush session A

Does this seem feasible? Is there a better way to achieve this, perhaps some mechanism to copy uncommitted state from the child to the parent??

Thanks

Louis


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.