Spring LDAP Framework

org.springframework.ldap.transaction.compensating.manager
Class ContextSourceAndHibernateTransactionManager

java.lang.Object
  extended by org.springframework.transaction.support.AbstractPlatformTransactionManager
      extended by org.springframework.orm.hibernate3.HibernateTransactionManager
          extended by org.springframework.ldap.transaction.compensating.manager.ContextSourceAndHibernateTransactionManager
All Implemented Interfaces:
Serializable, BeanFactoryAware, InitializingBean, PlatformTransactionManager, ResourceTransactionManager

public class ContextSourceAndHibernateTransactionManager
extends HibernateTransactionManager

A Transaction Manager to manage LDAP and Hibernate 3 operations within the same transaction. Note that even though the same logical transaction is used, this is not a JTA XA transaction; no two-phase commit will be performed, and thus commit and rollback may yield unexpected results.
This Transaction Manager is as good as it gets when you are using in LDAP in combination with a Hibernate 3 and unable to use XA transactions because LDAP is not transactional by design to begin with.
Furthermore, this manager does not support nested transactions

Since:
1.2.2
Author:
Hans Westerbeek
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
 
Constructor Summary
ContextSourceAndHibernateTransactionManager()
           
 
Method Summary
protected  void doBegin(Object transaction, TransactionDefinition definition)
           
protected  void doCleanupAfterCompletion(Object transaction)
           
protected  void doCommit(DefaultTransactionStatus status)
           
protected  Object doGetTransaction()
           
protected  void doResume(Object transaction, Object suspendedResources)
           
protected  void doRollback(DefaultTransactionStatus status)
           
protected  Object doSuspend(Object transaction)
           
 ContextSource getContextSource()
           
protected  boolean isExistingTransaction(Object transaction)
           
 void setContextSource(ContextSource contextSource)
           
protected  void setRenamingStrategy(TempEntryRenamingStrategy renamingStrategy)
           
 
Methods inherited from class org.springframework.orm.hibernate3.HibernateTransactionManager
afterPropertiesSet, convertHibernateAccessException, convertJdbcAccessException, doSetRollbackOnly, getDataSource, getDefaultJdbcExceptionTranslator, getEntityInterceptor, getJdbcExceptionTranslator, getResourceFactory, getSessionFactory, isSameConnectionForEntireSession, prepareForCommit, setAutodetectDataSource, setBeanFactory, setDataSource, setEarlyFlushBeforeCommit, setEntityInterceptor, setEntityInterceptorBeanName, setHibernateManagedSession, setJdbcExceptionTranslator, setPrepareConnection, setSessionFactory
 
Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
commit, determineTimeout, getDefaultTimeout, getTransaction, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, newTransactionStatus, prepareSynchronization, prepareTransactionStatus, registerAfterCompletionWithExistingTransaction, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, shouldCommitOnGlobalRollbackOnly, suspend, triggerBeforeCommit, triggerBeforeCompletion, useSavepointForNestedTransaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.transaction.PlatformTransactionManager
commit, getTransaction, rollback
 

Constructor Detail

ContextSourceAndHibernateTransactionManager

public ContextSourceAndHibernateTransactionManager()
Method Detail

isExistingTransaction

protected boolean isExistingTransaction(Object transaction)
Overrides:
isExistingTransaction in class HibernateTransactionManager

doGetTransaction

protected Object doGetTransaction()
                           throws TransactionException
Overrides:
doGetTransaction in class HibernateTransactionManager
Throws:
TransactionException

doBegin

protected void doBegin(Object transaction,
                       TransactionDefinition definition)
                throws TransactionException
Overrides:
doBegin in class HibernateTransactionManager
Throws:
TransactionException

doCleanupAfterCompletion

protected void doCleanupAfterCompletion(Object transaction)
Overrides:
doCleanupAfterCompletion in class HibernateTransactionManager

doCommit

protected void doCommit(DefaultTransactionStatus status)
                 throws TransactionException
Overrides:
doCommit in class HibernateTransactionManager
Throws:
TransactionException

doRollback

protected void doRollback(DefaultTransactionStatus status)
                   throws TransactionException
Overrides:
doRollback in class HibernateTransactionManager
Throws:
TransactionException

getContextSource

public ContextSource getContextSource()

setContextSource

public void setContextSource(ContextSource contextSource)

setRenamingStrategy

protected void setRenamingStrategy(TempEntryRenamingStrategy renamingStrategy)

doSuspend

protected Object doSuspend(Object transaction)
                    throws TransactionException
Overrides:
doSuspend in class HibernateTransactionManager
Throws:
TransactionException

doResume

protected void doResume(Object transaction,
                        Object suspendedResources)
                 throws TransactionException
Overrides:
doResume in class HibernateTransactionManager
Throws:
TransactionException

Spring LDAP Framework

Copyright © 2005-2010 The Spring LDAP Framework. All Rights Reserved.