Announcement Announcement Module
Collapse
No announcement yet.
Pre-bound JDBC Connection found - HibernateTransactionManager Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pre-bound JDBC Connection found - HibernateTransactionManager

    Hello guys, I have a problem with my HibernateTransactionManager.
    I need take data from one database (src) and store it in another (dest).
    I decide to have two transaction managers with diferent datasources.
    - I assign to one transactional service the first TransactionManager that perfoms the object load operation.
    - I assign to one transactional service the second TransactionManager that perfoms the object save operation in the "dest" database.

    When I am trying to save the object spring throws a exception:
    Code:
    org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found - HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:410)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:315)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:257)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
    	at $Proxy4.update(Unknown Source)
    	at com.ya.launch.kernel.business.InitialPackProduct.update(InitialPackProduct.java:74)
    	at com.ya.launch.web.services.impl.InitPackService.save(InitPackService.java:184)
    	at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:324)
    How can I do to obtain a solution about this. Actually I use PROPAGATION_NOT_SUPPORTED in the transactionAttributes of the second TransactionProxyFactoryBean but with this solution I lose the transaction...

    In what point I need to change the datasource.

    Thanks you!

    PD: Im Spanish and I speak English a little, Im sorry!!!

  • #2
    There were previous discussions about this subject:
    http://forum.springframework.org/showthread.php?t=24300

    Comment

    Working...
    X