This is a continuation of the discussion about the same issue<https://github.com/jOOQ/jOOQ/issues/2374> .
I recently discovered a problem when using insertInto() with returning()and dynamically created tables, when not using jOOQ's code generation feature. I'm not using the code generation because the underlying database is only known during runtime and might change. In that case the returned Record, which should contain the generated ID of the newly inserted row, is always *null*. That's because in AbstractStoreQuery#selectReturning()<https://github.com/jOOQ/jOOQ/blob/master/jOOQ/src/main/java/org/jooq/impl/AbstractStoreQuery.java#L356> the check if (into.getIdentity() != null) is always *false *since the dynamically generated table doesn't have an identity set. // record is always null Record record = create.insertInto(tableByName("MY_TABLE"), fieldByName("FIELD1"), fieldByName("FIELD2")) .values(values) .returning(fieldByName("ID_FIELD")) .fetchOne(); Lukas pointed me to CustomTable and also made it possible to overwrite getIdentity() by subtypes but I still don't understand how I can use this to fix my problem. Ok, I can now create an anonymous instance of CustomTable during runtime that represents the table and also specify an identity, but how do I add fields to my custom table? Because that would be the next issue of selectReturning(). Utils.newRecord() expects the table to return its fields via the fields() method that however is declared *final* in AbstractTable. I'm sure I'm just overlooking something here... Thanks your any help! Sven -- 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.
