On Friday, May 19, 2017 at 1:22:48 PM UTC-7, Lukas Eder wrote:
> 2017-05-19 18:08 GMT+02:00 <robert....@cloudability.com <javascript:>>:
>> 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 transaction function to execute just had 
>> the DSLContext?
> While the DSLContext type is quite useful to your SQL building usage, 
> Configuration is really the "interesting" type behind the scenes. It would 
> be a bit weird for DSLContext to be an argument type for any jOOQ SPI 
> method.

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 
inside a transaction and sometimes not inside a transaction:
public void updateBook(int bookId, int authorId) {}

Which of these alternative would be best, and is there an even better way?

public void updateBook(DSLContext context, int bookId, int authorId) {}
public void updateBook(Configuration configuration, int bookId, int 
authorId) {}
public void updateBook(Connection connection, int bookId, int authorId) {}

You comments here indicate that passing the DSLContext is not good, but 
which object should I pass?

Also, is there any difference between calling DSL.using(configuration) 
compared to configuration.dsl() ?

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 jooq-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to