2013/4/5 Witold Szczerba <[email protected]>:
> On 5 April 2013 17:37, Lukas Eder <[email protected]> wrote:
>>
>> But this doesn't mean that it's necessarily a bad idea for the jOOQ
>> DSL to provide this "with(configuration)" method in the static
>> factory...
>>
>>
>
>
> OK, imagine you cannot just connect to database and write things like:
>
> SELECT * FROM BOOK
> WHERE PUBLISHED_IN = 2011
> ORDER BY TITLE
>
> but instead you have each and every time describe the way to the database:
>
> CONNECT TO ORACLE@URL.....
> AS USER X WITH PASSWORD Y
> SELECT * FROM BOOK
> WHERE PUBLISHED_IN = 2011
> ORDER BY TITLE
>
> and then again:
>
> CONNECT TO ORACLE@URL.....
> AS USER X WITH PASSWORD Y
> SELECT * FROM BOOK
> WHERE PUBLISHED_IN = 2011
> ORDER BY TITLE
>
> this is what it looks like when each time you starts with
> with(myDatabaseConfigurationObject)
> .select(....)
> .from(....)
I don't know where you're trying to go with this. No one keeps you
from reusing the same reference returned from a single call to
"with(configuration)" for repetitive use! It's up to you.
Let's have another example. JDBC.
Choose or not to re-create the JDBC Connection for every single
Statement execution. It's up to you. You have dozens of ways of
actually creating a Connection. Write (pseudo code):
@Inject Connection c;
void myMethod() {
c.prepareStatement("abc").executeUpdate();
c.prepareStatement("xyz").execute();
}
Or instead, write
void myMethod() {
// Ignore closing of resources for the example
dataSource.getConnection().prepareStatement("abc").executeUpdate();
dataSource.getConnection().prepareStatement("xyz").execute();
}
Isn't it nice that you have the flexibility? Or did you mean something
entirely else?
--
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/groups/opt_out.