Hi Victor,

Thank you very much for your message. I've created a bug report for this
issue, which I believe is a bug:
https://github.com/jOOQ/jOOQ/issues/9409

At first sight, the outer query should throw an exception, as the
transactional semantics is undefined. We could, of course, define it
retroactively. I *think* that what happens is you inherit the datasource's
default auto commit flag, which might be "true", so you will run each query
in its own transaction.

Fixing this will not be easy as a lot of applications may already depend on
the current behaviour. We'll think about it. Thanks again for bringing this
to our attention.

Lukas

On Fri, Oct 18, 2019 at 11:54 AM Victor Noël <[email protected]> wrote:

> Hi,
>
> I was playing with transaction support in jOOQ and faced the following
> situation that surprised me (this is pseudo-code and very simplifying to
> illustrate the heart of the question):
>
> var leaked = DSL
>   .using(datasource, SQLDialect.POSTGRES)
>   .transactionResult(conf -> {
>     var tx = DSL.using(conf);
>     tx.select(...).fetch();
>     return tx;
>   });
>
> leaked.select(...).fetch();
>
> I would have expected the first select to succeed and the second one to
> fail, because I leaked the context out of the transaction and used it after
> it was closed.
>
> But maybe I'm making incorrect assumptions?
>
> What happens in this case, the leaked select will just be executed outside
> of any transaction?
>
> Thanks
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/d169e71a-3a31-4d89-9400-0bc9911952fc%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/d169e71a-3a31-4d89-9400-0bc9911952fc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO6PD-ZXoOA--3T-V7%2BjBJUSM0e%2B9p88ZZNdwG5Tmd%2B59g%40mail.gmail.com.

Reply via email to