Hi,
I'm working on a spring (4.0.2)+ JOOQ (3.3.0) project, where I'm facing issue with transactions.
I have set up the jooq datasource connection provider to be transaction-aware in my servlet context as below:
<bean id="transactionAwareDataSource"
class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<constructor-arg ref="dataSource" />
</bean>
<bean class="org.jooq.impl.DataSourceConnectionProvider" name="connectionProvider">
<constructor-arg ref="transactionAwareDataSource" />
</bean>
I have methods in my service class which are decorated with @Transactional. However, when an exception occurs, I find that the transaction doesn't get rolled back (i.e. the database inserts I did in the service method get stored in db).
However, if I explicitly start a transaction myself in the method like so:
TransactionStatus tx = txMgr.getTransaction(new DefaultTransactionDefinition());
and roll it back myself in exception handler like so:
txMgr.rollback(tx);
That seems to work as I expect.
What am I possibly missing to make @Transactional declaration work as we expect them to work with JOOQ?
Thanks and Regards,
Sachin