Open matt-snider opened 2 years ago
@dstepanov Any thoughts on this one? From your comment it sounded like you had some idea of how this could be fixed. I could take a look if you point me in the right direction
Issue still present with Micronaut data 4.7.0
@faustin0 you need to use Connectable annotation.
@faustin0 you need to use Connectable annotation.
thanks @donbeave, but do i need to use it on every method where i'm expected to do some query ? in this case, isn't it a little uncomfortable?
@faustin0 frankly say I prefer this approach more than invisible magic with opening connection during execution for the query, this make it informative inside the code where you will get a connection from the pool. Probably, you can make a PR to the micronaut-sql
project to add an ability to pull connection when you call jOOQ to execute the query.
@faustin0 please check this interface: https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/ConnectionProvider.html
@faustin0 looks like, you just need to pass https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/impl/DataSourceConnectionProvider.html to the jOOQ configuration with correct datasource.
@faustin0 looks like, you just need to pass https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/impl/DataSourceConnectionProvider.html to the jOOQ configuration with correct datasource.
I'm using the out of the box configuration of micronaout-jooq:
https://github.com/micronaut-projects/micronaut-sql/blob/5.7.x/jooq/src/main/java/io/micronaut/configuration/jooq/JooqConfigurationFactory.java#L105
this should be the correct datasource, right?
(by the way i "resolved" it using a transactionManager.withTransaction
on the upper level of a graphQL server "ExecutionStrategy", before any db call)
Expected Behavior
When using Micronaut's Transaction Management with JOOQ, we should be able to define methods both with and without
@Transactional
as in this example controller:Actual Behaviour
When we mix methods with and without
@Transactional
we get the following error when calling the method without it:As commented here by @dstepanov:
Steps To Reproduce
gradle test --info
spring-tx
branch, where test succeedsEnvironment Information
No response
Example Application
https://github.com/matt-snider/micronaut-tx-issues
Version
3