public class Neo4jTransactionManager
extends org.springframework.transaction.support.AbstractPlatformTransactionManager
implements org.springframework.transaction.support.ResourceTransactionManager, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.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
org.springframework.transaction.jta.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 Form| 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,
org.springframework.transaction.TransactionDefinition definition) |
protected void |
doCleanupAfterCompletion(Object transaction) |
protected void |
doCommit(org.springframework.transaction.support.DefaultTransactionStatus status) |
protected Object |
doGetTransaction() |
protected void |
doResume(Object transaction,
Object suspendedResources) |
protected void |
doRollback(org.springframework.transaction.support.DefaultTransactionStatus status) |
protected void |
doSetRollbackOnly(org.springframework.transaction.support.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(org.springframework.beans.factory.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, useSavepointForNestedTransactionpublic 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(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic Object getResourceFactory()
getResourceFactory in interface org.springframework.transaction.support.ResourceTransactionManagerprotected Object doGetTransaction()
doGetTransaction in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected boolean isExistingTransaction(Object transaction)
isExistingTransaction in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected void doBegin(Object transaction, org.springframework.transaction.TransactionDefinition definition) throws org.springframework.transaction.TransactionException
doBegin in class org.springframework.transaction.support.AbstractPlatformTransactionManagerorg.springframework.transaction.TransactionExceptionprotected Object doSuspend(Object transaction)
doSuspend in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected void doResume(Object transaction, Object suspendedResources)
doResume in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected void doCommit(org.springframework.transaction.support.DefaultTransactionStatus status)
doCommit in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected void doRollback(org.springframework.transaction.support.DefaultTransactionStatus status)
doRollback in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected void doSetRollbackOnly(org.springframework.transaction.support.DefaultTransactionStatus status)
doSetRollbackOnly in class org.springframework.transaction.support.AbstractPlatformTransactionManagerprotected void doCleanupAfterCompletion(Object transaction)
doCleanupAfterCompletion in class org.springframework.transaction.support.AbstractPlatformTransactionManagerCopyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.