public class Neo4jTransactionManager extends AbstractPlatformTransactionManager implements ResourceTransactionManager, BeanFactoryAware, InitializingBean
PlatformTransactionManager
implementation
for a single Neo4j OGM SessionFactory
. Binds a Neo4j OGM
Session from the specified factory to the thread, potentially allowing for
one thread-bound Session per factory. SharedSessionCreator
is aware of thread-bound session and participates
in such transactions automatically. It is required for Neo4j OGM access code
supporting this transaction management mechanism.
This transaction manager is appropriate for applications that use a single
Neo4j OGM SessionFactory for transactional data access. JTA (usually through
JtaTransactionManager
) has not been tested
or considered at the moment.
This transaction manager does not support nested transactions or requires new propagation.
setSessionFactory(org.neo4j.ogm.session.SessionFactory)
,
Serialized FormSYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
Constructor and Description |
---|
Neo4jTransactionManager()
Create a new Neo4jTransactionManager instance.
|
Neo4jTransactionManager(org.neo4j.ogm.session.SessionFactory sessionFactory)
Create a new Neo4jTransactionManager instance.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
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 void |
doSetRollbackOnly(DefaultTransactionStatus status) |
protected Object |
doSuspend(Object transaction) |
Object |
getResourceFactory() |
org.neo4j.ogm.session.SessionFactory |
getSessionFactory()
Return the SessionFactory that this instance should manage transactions for.
|
protected boolean |
isExistingTransaction(Object transaction) |
void |
setBeanFactory(BeanFactory beanFactory)
Retrieves a default SessionFactory bean.
|
void |
setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Set the SessionFactory that this instance should manage transactions for.
|
commit, determineTimeout, getDefaultTimeout, getTransaction, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, newTransactionStatus, prepareForCommit, prepareSynchronization, prepareTransactionStatus, registerAfterCompletionWithExistingTransaction, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, shouldCommitOnGlobalRollbackOnly, suspend, triggerBeforeCommit, triggerBeforeCompletion, useSavepointForNestedTransaction
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
commit, getTransaction, rollback
public Neo4jTransactionManager()
An SessionFactory has to be set to be able to use it.
setSessionFactory(SessionFactory)
public Neo4jTransactionManager(org.neo4j.ogm.session.SessionFactory sessionFactory)
sessionFactory
- SessionFactory to manage transactions forpublic void setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
By default, a default SessionFactory will be retrieved by finding a single unique bean of type SessionFactory in the containing BeanFactory.
public org.neo4j.ogm.session.SessionFactory getSessionFactory()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public Object getResourceFactory()
getResourceFactory
in interface ResourceTransactionManager
protected Object doGetTransaction()
doGetTransaction
in class AbstractPlatformTransactionManager
protected boolean isExistingTransaction(Object transaction)
isExistingTransaction
in class AbstractPlatformTransactionManager
protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException
doBegin
in class AbstractPlatformTransactionManager
TransactionException
protected Object doSuspend(Object transaction)
doSuspend
in class AbstractPlatformTransactionManager
protected void doResume(Object transaction, Object suspendedResources)
doResume
in class AbstractPlatformTransactionManager
protected void doCommit(DefaultTransactionStatus status)
doCommit
in class AbstractPlatformTransactionManager
protected void doRollback(DefaultTransactionStatus status)
doRollback
in class AbstractPlatformTransactionManager
protected void doSetRollbackOnly(DefaultTransactionStatus status)
doSetRollbackOnly
in class AbstractPlatformTransactionManager
protected void doCleanupAfterCompletion(Object transaction)
doCleanupAfterCompletion
in class AbstractPlatformTransactionManager
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.