Hi,
I am using native id generation and spring declarative transaction. Now, in a method that is wrapped in transaction, the updates rollback but not the inserts. The insert rollback works when I change the id generation to increment. We require to use a native id generation, since, we may have multiple hibernate applications hitting the same database.
Following are my configurations:
Code:
<hibernate-mapping>
<class name="com.company.product.hb.Users" table="Users">
<id name="id" type="java.lang.Long">
<column name="id" />
<generator class="native" />
</id>
...
Code:
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<constructor-arg>
<ref local="sessionFactory"/>
</constructor-arg>
</bean>
<bean id="UserManagerService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="target" ref="UserManager" />
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="*">
PROPAGATION_REQUIRED,
-java.lang.Exception
</prop>
</props>
</property>
</bean>
Kindly let me know if I have missed out any more info required.
Thanks for any pointers,
Samarth