Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Spring Data Neo4j transactions mixed with Hibernate transactions

  1. #11
    Join Date
    Feb 2011
    Location
    Odessa, Ukraine
    Posts
    11

    Default HibernateTransactionManager

    I found this to be quite problematic also. It took me some time to figure out what was going wrong.

    In the end I settled on this solution for the ChainedTransactionManager
    Hi, does it work with JPA?
    I've tried ChainedTransactionManager with org.springframework.orm.hibernate3.HibernateTransa ctionManager but it works only with "read" operations. Any attempt to write something to DB produces an error

    Code:
     [org.springframework.transaction.CannotCreateTransactionException: 
    Could not open Hibernate Session for transaction; nested exception is java.lang.IllegalStateException: Already value [org.springframework.orm.hibernate3.SessionHolder@13122a1] for key [org.hibernate.impl.SessionFactoryImpl@580334] bound to thread [btpool0-3]]
    My configuration

    Code:
    	<bean id="hbTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="prodSessionFactory" />
    	</bean>
    
    	<bean id="chainedTM" class="org.springframework.data.neo4j.transaction.ChainedTransactionManager">
    		<constructor-arg>
    			<list>
    				<ref bean="hbTransactionManager" />
    				<ref bean="jcrTransactionManager" />
    				<ref bean="xaTransactionManager" />
    			</list>
    		</constructor-arg> 
    	</bean>
    Thanks in advance
    Alexander
    Last edited by akorotenko; Aug 30th, 2012 at 05:53 AM.

  2. #12
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    Could be lots of reasons.

    How are you creating Sessions in Hibernate. are you using sessionFactory.getCurrentSession() everywhere?
    Where are you setting your @Transactional in your code?

    Mark

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •