|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.AbstractPlatformTransactionManager org.springframework.orm.ojb.PersistenceBrokerTransactionManager
PlatformTransactionManager implementation for a single OJB persistence broker key. Binds an OJB PersistenceBroker from the specified key to the thread, potentially allowing for one thread PersistenceBroker per key. OjbFactoryUtils and PersistenceBrokerTemplate are aware of thread-bound persistence brokers and participate in such transactions automatically. Using either is required for OJB access code supporting this transaction management mechanism.
This implementation is appropriate for applications that solely use OJB for transactional data access. JTA respectively JtaTransactionManager is necessary for accessing multiple transactional resources, in combination with transactional DataSources as connection pools (to be specified in OJB's configuration).
setJcdAlias(java.lang.String)
,
setPbKey(org.apache.ojb.broker.PBKey)
,
OjbFactoryUtils.getPersistenceBroker(org.apache.ojb.broker.PBKey, boolean)
,
OjbFactoryUtils.closePersistenceBrokerIfNecessary(org.apache.ojb.broker.PersistenceBroker, org.apache.ojb.broker.PBKey)
,
PersistenceBrokerTemplate.execute(org.springframework.orm.ojb.PersistenceBrokerCallback)
,
JtaTransactionManager
,
Serialized FormField Summary |
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager |
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION |
Constructor Summary | |
PersistenceBrokerTransactionManager()
Create a new PersistenceBrokerTransactionManager, sing the default connection configured for OJB. |
|
PersistenceBrokerTransactionManager(org.apache.ojb.broker.PBKey pbKey)
Create a new PersistenceBrokerTransactionManager. |
|
PersistenceBrokerTransactionManager(String jcdAlias)
Create a new PersistenceBrokerTransactionManager. |
Method Summary | |
protected void |
closePersistenceBrokerIfNecessary(org.apache.ojb.broker.PersistenceBroker pb)
Close the given PersistenceBroker, created for the PBKey of this transaction manager, if it isn't bound to the thread. |
protected void |
doBegin(Object transaction,
TransactionDefinition definition)
Begin a new transaction with the given transaction definition. |
protected void |
doCleanupAfterCompletion(Object transaction)
Cleanup resources after transaction completion. |
protected void |
doCommit(DefaultTransactionStatus status)
Perform an actual commit on the given transaction. |
protected Object |
doGetTransaction()
Return a current transaction object, i.e. a JTA UserTransaction. |
protected void |
doResume(Object transaction,
Object suspendedResources)
Resume the resources of the current transaction. |
protected void |
doRollback(DefaultTransactionStatus status)
Perform an actual rollback on the given transaction. |
protected void |
doSetRollbackOnly(DefaultTransactionStatus status)
Set the given transaction rollback-only. |
protected Object |
doSuspend(Object transaction)
Suspend the resources of the current transaction. |
DataSource |
getDataSource()
Return the JDBC DataSource that this instance manages transactions for. |
org.apache.ojb.broker.PBKey |
getPbKey()
Return the PBKey of the PersistenceBroker configuration used. |
protected org.apache.ojb.broker.PersistenceBroker |
getPersistenceBroker()
Get an OJB PersistenceBroker for the PBKey of this transaction manager. |
protected boolean |
isExistingTransaction(Object transaction)
Check if the given transaction object indicates an existing, i.e. already begun, transaction. |
void |
setDataSource(DataSource dataSource)
Set the JDBC DataSource that this instance should manage transactions for. |
void |
setJcdAlias(String jcdAlias)
Set the JDBC Connection Descriptor alias of the PersistenceBroker configuration to use. |
void |
setPbKey(org.apache.ojb.broker.PBKey pbKey)
Set the PBKey of the PersistenceBroker configuration to use. |
Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager |
commit, getTransaction, getTransactionSynchronization, isNestedTransactionAllowed, isRollbackOnCommitFailure, rollback, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName, useSavepointForNestedTransaction |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PersistenceBrokerTransactionManager()
public PersistenceBrokerTransactionManager(String jcdAlias)
jcdAlias
- the JDBC Connection Descriptor alias
of the PersistenceBroker configuration to usepublic PersistenceBrokerTransactionManager(org.apache.ojb.broker.PBKey pbKey)
pbKey
- the PBKey of the PersistenceBroker configuration to useMethod Detail |
public void setJcdAlias(String jcdAlias)
public void setPbKey(org.apache.ojb.broker.PBKey pbKey)
public org.apache.ojb.broker.PBKey getPbKey()
public void setDataSource(DataSource dataSource)
A transactional JDBC Connection for this DataSource will be provided to application code accessing this DataSource directly via DataSourceUtils or JdbcTemplate. The Connection will be taken from the Hibernate Session.
LocalDataSourceConnectionProvider
,
LocalSessionFactoryBean.setDataSource(javax.sql.DataSource)
,
DataSourceUtils.getConnection(javax.sql.DataSource)
,
JdbcTemplate
public DataSource getDataSource()
protected org.apache.ojb.broker.PersistenceBroker getPersistenceBroker()
Default implementation delegates to OjbFactoryUtils. Can be overridden in subclasses, e.g. for testing purposes.
setJcdAlias(java.lang.String)
,
setPbKey(org.apache.ojb.broker.PBKey)
,
OjbFactoryUtils.getPersistenceBroker(org.apache.ojb.broker.PBKey, boolean)
protected void closePersistenceBrokerIfNecessary(org.apache.ojb.broker.PersistenceBroker pb)
Default implementation delegates to OjbFactoryUtils. Can be overridden in subclasses, e.g. for testing purposes.
pb
- PersistenceBroker to closesetJcdAlias(java.lang.String)
,
setPbKey(org.apache.ojb.broker.PBKey)
,
OjbFactoryUtils.closePersistenceBrokerIfNecessary(org.apache.ojb.broker.PersistenceBroker, org.apache.ojb.broker.PBKey)
protected Object doGetTransaction()
AbstractPlatformTransactionManager
doGetTransaction
in class AbstractPlatformTransactionManager
protected boolean isExistingTransaction(Object transaction)
AbstractPlatformTransactionManager
isExistingTransaction
in class AbstractPlatformTransactionManager
transaction
- transaction object returned by doGetTransaction
protected void doBegin(Object transaction, TransactionDefinition definition)
AbstractPlatformTransactionManager
doBegin
in class AbstractPlatformTransactionManager
transaction
- transaction object returned by doGetTransactiondefinition
- TransactionDefinition instance, describing
propagation behavior, isolation level, timeout etc.protected Object doSuspend(Object transaction)
AbstractPlatformTransactionManager
doSuspend
in class AbstractPlatformTransactionManager
transaction
- transaction object returned by doGetTransaction
AbstractPlatformTransactionManager.doResume(java.lang.Object, java.lang.Object)
protected void doResume(Object transaction, Object suspendedResources)
AbstractPlatformTransactionManager
doResume
in class AbstractPlatformTransactionManager
transaction
- transaction object returned by doGetTransactionsuspendedResources
- the object that holds suspended resources,
as returned by doSuspendAbstractPlatformTransactionManager.doSuspend(java.lang.Object)
protected void doCommit(DefaultTransactionStatus status)
AbstractPlatformTransactionManager
doCommit
in class AbstractPlatformTransactionManager
status
- status representation of the transactionprotected void doRollback(DefaultTransactionStatus status)
AbstractPlatformTransactionManager
doRollback
in class AbstractPlatformTransactionManager
status
- status representation of the transactionprotected void doSetRollbackOnly(DefaultTransactionStatus status)
AbstractPlatformTransactionManager
doSetRollbackOnly
in class AbstractPlatformTransactionManager
status
- status representation of the transactionprotected void doCleanupAfterCompletion(Object transaction)
AbstractPlatformTransactionManager
Default implementation does nothing.
doCleanupAfterCompletion
in class AbstractPlatformTransactionManager
transaction
- transaction object returned by doGetTransaction
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |