Hi Sachin,
First check the TransactionInterceptor aspect is properly applied on your
service class: you can place breakpoint in the method and check that
TransactionInteceptor is present, or you can place a breakpoint un
TransactionInterceptor.
Then, what kind of Exception is thrown? By default, Spring only rollbacks
RuntimeException, jOOQ exceptions fall into this category. Did you override
exception handling @Transactional(rollbackFor={MyCustomException.class})?
Gerald
Le jeudi 3 avril 2014 12:19:01 UTC+2, Sachin Kulkarni a écrit :
>
> 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
>
>
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.