Failing to manage mix of jdbc and hibernate transaction under Spring

Hi

My application has some dynamic tables where we are generating table names and the columns based upon client requirements,for this dynamic tables we are using jdbc and the rest is hibernate .here i am unable to propagate the same transation from hibernate to jdbc.When something fails in middle i am unable to rollback completely , because i am unable to manage a single transaction.The jdbc code is being comitted and hiberbnate rollsback.

I wrap anykind of exception in my custom VAMException

and this is my configuration code

<bean id="utilTransactionManager"

class="org.springframework.orm.hibernate3.HibernateTransactionManager">

<property name="sessionFactory">

<ref local="utilSessionFactory" />

</property>

</bean>

<bean id="publishratingTarget"

class="com.valuemomentum.plm.rating.publish.PublishRating">

<property name="sessionFactory">

<ref local="utilSessionFactory" />

</property>

</bean>

<bean id="publishratingProxy"

class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

<property name="transactionManager">

<ref local="utilTransactionManager" />

</property>

<property name="target">

<ref local="publishratingTarget" />

</property>

<property name="proxyTargetClass" value="true" />

<property name="transactionAttributes">

<props>

<prop key="*">PROPAGATION_REQUIRED,-VAMException</prop>

</props>

</property>

</bean>

Firstly, can i propagate a single transaction in a mix of jdbc and hibernate

If not possible

any ideal solution for this problem

TNX in adv

Message was edited by:

dee_vam

[1830 byte] By [dee_vama] at [2007-11-27 11:41:07]
# 1

Why are you using the HibernateTransactionManager? I'd recommend either the app server's transaction manager, which you access using a JNDI lookup using the name javax.transaction.TransactionManager and the JndiObjectFactoryBean, OR another JTA implementation like DataSourceTransactionManager.

It also assumes that your JDBC code isn't doing any commits or rollbacks on its own, and that you have a sensible service layer that demarks the unit of work.

%

duffymoa at 2007-7-29 17:36:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Firstly tnx for the reply

I hav tried using DataSourceTransactionManager also.It does not rollback

I have even tried using annotation based transaction management even tht fails for th source files when there is a mix of jdbc and hibernate code.It works fine with complete hibernate or complete jdbc

dee_vama at 2007-7-29 17:36:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

Are Hibernate and JDBC talking to the same database? Or two?

%

duffymoa at 2007-7-29 17:36:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...