Hello,

Many of our users do use jOOQ and JPA within the same application. Using
the two within the same transactions will work with the usual caveats of
JPA implementations being unaware of changes made to the database that
should affect the second-level cache.

Apart from this expected caveat, I suspect that your approach will be OK,
although, I'm not sure what this getObject() method is on your
EntityManagerFactory.

I've added an issue to document this in new examples:
https://github.com/jOOQ/jOOQ/issues/3910

2015-01-08 22:22 GMT+01:00 Robert DiFalco <[email protected]>:

> Unless I'm missing something it appears that you can make JOOQ and JPA
> coexist with @Transactional if you make the following changes to the
> example in GitHUB.
>
> Here's the example code:
> https://github.com/jOOQ/jOOQ/tree/master/jOOQ-examples/jOOQ-spring-boot-example/src/main/java/org/jooq/example/spring
>
> 1. In SpringTransactionProvider.java change the injected tx from
> DataSourceTransactionManager to PlatformTransactionManager (it's the
> interface DataSourceTransactionManager implements).
> 2. In Application.java replace the following method:
>
> @Bean
> public DataSourceTransactionManager transactionManager(DataSource
> dataSource) {
>     return new DataSourceTransactionManager(dataSource);
> }
>
>
> With:
>
> @Bean
> public PlatformTransactionManager transactionManager() {
>      return new JpaTransactionManager(entityManagerFactory().getObject());
> }
>
>
> The EntityManagerFactory should already be defined in your config. That's
> pretty much it. Since the EntityManager has your dataSource already it
> should allow the two to coexist with transactions.
>
> This should make it easier to migrate from JPA to JOOQ incrementally.
>
> Let me know if I've missed anything.
>
> R.
>
>
>  --
> 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.
>

-- 
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.

Reply via email to