Hello Vladislav, > I have a primary key in the table (auto-incrementing). How do I get > the last auto-generated value for it? JDBC has getGeneratedKeys() > method of the statement. And MySQL itself has LAST_INSERT_ID() > function, but jooq seems to use neither?
That is not yet supported, as most RDBMS support the concept of sequences. However, with MySQL, there currently isn't a way to read generated IDs with jOOQ. I will schedule a solution for the next release 1.5.8: https://sourceforge.net/apps/trac/jooq/ticket/416 In the mean time, you can use plain SQL fields to select the LAST_INSERT_ID() from MySQL, as a workaround. Something like this: Field<Integer> ID = create.plainSQLField("LAST_INSERT_ID()", Integer.class); create.select(ID).fetchOne(ID); Regards Lukas
