Hi Lukas,

I currently compare jOOQ and Hibernate in terms of rendered and executed 
statements. For my tests I use MySQL and for the low level profiling I use 
the tool "Neor Profile SQL".

Inserting new rows to a table with a primary key declared as AUTO_INCREMENT 
shows me that jOOQ renders and executes an explicit

SELECT [pk column] FROM [table] WHERE [pk column] = [value]

after each INSERT statement.

However Hibernate does not execute such an additional SELECT statement.

>From the documentation of the JDBC driver for MySQL Connector/J I see that 
it supports the method getGeneratedKeys() to retrieve the assigned value.
So an additionall SELECT statement is not necessary, isn't it?

I debugged jOOQ's code execution and come across code lines 234ff. in class 
TableRecordImpl:

// [#1859] In some databases, not all fields can be fetched via 
getGeneratedKeys()
if (REFRESH_GENERATED_KEYS.contains(configuration().family()) && this 
instanceof UpdatableRecord)
    ((UpdatableRecord<?>) this).refresh(key.toArray(EMPTY_FIELD));

And to me here is the problem, because the enumeration 
REFREH_GENERATED_KEYS contains the MySQL dialect, which seems to be wrong.
Can you confirm this?

If the behaviour is correct, are there any other possibilty the prevent 
executing the extra SELECT statement after each INSERT statement.

Kind regards,
Marcus

-- 
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/d/optout.

Reply via email to