2013/4/2 Peter Cooner <[email protected]>: > > On Mon, Apr 1, 2013 at 1:56 PM, Lukas Eder <[email protected]> wrote: >> >> >> Topic #1: Static vs. contextual Factory methods >> =============================================== >> > > I really liked the separating of the contextual / static query functions in > JOOQ 3 - it just feels right - like real SQL. The guys I'm working with > found it liberating.
Thanks Peter. I'm glad you've mentioned it. I remember that Sergey Epik also expressed his liking for the "contextual" API >> >> Topic #2: "Executor" as a name >> ============================== >> >> select().from(TABLE) >> .where(conditions) >> .orderBy(ID); >> >> Here's how you'd create "contextual", and thus executable queries: >> >> with(configuration) >> .select() >> .from(TABLE) >> .orderBy(ID) >> .fetch(); >> >> Here's how you'd use batch queries: >> >> with(connection, dialect) // Alternatively to with(configuration) >> .batch( >> insertInto(TABLE_A).values(1, 2, 3), >> insertInto(TABLE_B).values(4, 5, 6) >> ) >> .execute(); >> >> Now the object returned by "with()" doesn't need to be called >> Executor. Neither do we need to use the term "with()", as that might >> cause confusion in the future, once jOOQ supports common table >> expressions. But you get the idea. What would you think of this >> alternative route? >> > > I really like the idea of with(connection, dialect) - how would you attach > the schema mappings? (they already use a similar .withMapping() function > style (sort of). "with()" itself would be overloaded several times, just like today's jOOQ 3.0-RC2 Executor constructors: http://www.jooq.org/javadoc/latest/org/jooq/impl/Executor.html Besides, I could imagine that you could call with() several times in a row, kind of like: with(connection) .with(dialect) .with(settings) .select(...) .from(...) .fetch(); As I said before, "with()" is not a final decision. I have to assess whether "with()" will cause conflicts with a future support for common table expressions > Though I'm a little worried about the fact that right now I have to extend > Executor myself for use in Google Guice Injection. This might not play well > with that. Feel free to elaborate on that (possibly in another thread if not quite on-topic?). Note though, that I might keep a public default constructor around in the type returned by "with()". This would allow for keeping things the way they are today: new TheTypeFormerlyKnownAsExecutor() .with(connection) .with(dialect) ... >> >> Topic #3: Factory and Executor as short names in general >> ======================================================== >> > > For myself, I've found static importing "Factory" a little strange - maybe > it could be renamed to something like Queries or what if they were broken > out into different classes named for the section they are from such as > Selects, Froms, Joins, Conditions (or Wheres) etc... Please suggest your ideas on this thread here: https://groups.google.com/forum/?fromgroups=#!topic/jooq-user/U4i33PL_-8Y > This is how I've token to implementing extensions to JOOQ - creating static > functions in a class which is then static imported. I could give examples, > if people are interested but I thought that might be off topic. :-) Yes, sure! Success stories, experiences, etc are always welcome. Maybe in another thread, though... Cheers Lukas -- 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.
