[hibernate-dev] Feature for handling getNextValue work in same transaction.

Jeremy Whiting jwhiting at redhat.com
Thu Aug 8 11:21:13 EDT 2013


Hi,
  I am looking for feedback on changes to provide the ability for work 
to be completed in a currently running transaction. For example when a 
TableGenerator or SequenceGenerator is being used for generating unique 
ids. The statements that select then update the db are executed in a 
separate transaction.

  There is a jira for this feature.

https://hibernate.atlassian.net/browse/HHH-8429

  Attached to the jira is a diagram. See this link
https://hibernate.atlassian.net/secure/attachment/19534/hibernate-class-structure-allowing-same-tx-support.png

  This diagram shows what I currently have implemented. It shows the 
existing classes and the new classes shaded in light blue. The methods 
on a new class IsolationAware show how I've re-jigged most the 
implementation from JtaTransaction to it's new ancestor IsolationAware. 
A new concrete implementation of IsolationDelegate will negotiate the 
work to be executed in the same running transaction.
  The structure splits up the factory/transaction/delegate classes into 
two groups. "same transaction" and "separate transaction". This has only 
been done for JtaTransaction and the same will probably be necessary for 
CMTTransaction as it also uses a separate transaction to complete work. 
That has been left out to keep the diagram simple.

  The option of using aggregation at the point where implementers of 
TransactionImplementor are instantiated has been considered. Before too 
much effort is expended coding I wondered what others thought is the 
preferred way to implement this feature.

Jeremy



More information about the hibernate-dev mailing list