Re: Transaction questions

2018-02-23 Thread Robert DiFalco
For those I pass the DSLContext from within the transaction to the method as an argument. That way I don’t nest transactions. Sent from my iPhone > On Feb 23, 2018, at 4:08 PM, Ed Erwin wrote: > > Thanks Robert. > > That is pretty cool. But it seems to be hard to use correctly for nested >

Re: Transaction questions

2018-02-23 Thread Ed Erwin
Thanks Robert. That is pretty cool. But it seems to be hard to use correctly for nested transactions or any other case where the function you pass to "apply" needs to call subroutines. You could pass your "Transactor" to subroutines giving them access to your original DSLContext, but they wou

Re: Transaction questions

2018-02-23 Thread Robert DiFalco
One of the problems I had with the JOOQ transaction approach is that I could not enforce that users only make SQL calls through a transaction. I solved it by making this little class. class Transactor { private final DSLContext ctx; Transactor(DSLContext ctx) { this.ctx = ctx;

Re: Transaction questions

2018-02-23 Thread Ed Erwin
On Friday, February 23, 2018 at 1:57:09 AM UTC-8, Lukas Eder wrote: > > Hi Ed, > > >> Also, is there any difference between calling DSL.using(configuration) >> compared to configuration.dsl() ? >> > > No. The latter was introduced merely for convenience: > https://github.com/jOOQ/jOOQ/issues/6

Re: Transaction questions

2018-02-23 Thread Lukas Eder
Hi Ed, 2018-02-23 1:27 GMT+01:00 Ed Erwin : > I'm struggling to try to find the right way to pass context (or > configuration or transaction or connection) around between multiple > separate methods of my classes. > > Suppose I have a method like this, and I want to call it perhaps sometimes > in

Re: Transaction questions

2018-02-22 Thread Ed Erwin
On Friday, May 19, 2017 at 1:22:48 PM UTC-7, Lukas Eder wrote: > > > > 2017-05-19 18:08 GMT+02:00 >: > >> Sorry if this has been asked before, but I have two basic questions. >> >> 1. Why do the functions for the transaction methods take a config instead >> of a DSLContext? Couldn't you have jus

Re: Transaction questions

2017-05-22 Thread Lukas Eder
Hi Robert, I think I gave you already an answer to this :) > In hindsight, it might have been interesting to introduce a TransactionContext that would give access to Configuration and, perhaps, DSLContext. Hope this helps, Lukas 2017-05-20 4:39 GMT+02:00 : > That's perfect Lukas, thanks. I don

Re: Transaction questions

2017-05-19 Thread robert . difalco
That's perfect Lukas, thanks. I don't know that I've ever done anything interesting with Configuration other than bootstrap it, create a DSLContext and forget about it. Is there a blog post or anything that talks about the valuable things I could do with a configuration within a Transaction fun

Re: Transaction questions

2017-05-19 Thread Lukas Eder
2017-05-19 18:08 GMT+02:00 : > Sorry if this has been asked before, but I have two basic questions. > > 1. Why do the functions for the transaction methods take a config instead > of a DSLContext? Couldn't you have just gotten the DSLContext internally > with DSL.using(config) so that the transact