jOOQ and autogeneration, how to avoid UDT Records inside table POJOs jOOQ and autogeneration, how to avoid UDT Records inside table POJOs postgresql postgresql

jOOQ and autogeneration, how to avoid UDT Records inside table POJOs


The reason it is doing what it is doing is because a View does not have a PrimaryKey associated with it, at least not with most databases, I can't think of a single one that would report back a PrimaryKey for a view.

You can specify the primary key to the generate using either the <syntheticPrimaryKeys> or you can use <overridePrimaryKeys> as described in the advanced generator configuration section of the manual.

Relevant parts of jooq-meta configuration:

<!-- A regular expression matching all columns that participate in "synthetic" primary keys,       which should be placed on generated UpdatableRecords, to be used with        - UpdatableRecord.store()        - UpdatableRecord.update()        - UpdatableRecord.delete()        - UpdatableRecord.refresh()       Synthetic primary keys will override existing primary keys. -->  <syntheticPrimaryKeys>SCHEMA\.TABLE\.COLUMN(1|2)</syntheticPrimaryKeys><!-- All (UNIQUE) key names that should be used instead of primary keys on       generated UpdatableRecords, to be used with        - UpdatableRecord.store()        - UpdatableRecord.update()        - UpdatableRecord.delete()        - UpdatableRecord.refresh()        If several keys match, a warning is emitted and the first one encountered will be used.        This flag will also replace synthetic primary keys, if it matches. -->  <overridePrimaryKeys>MY_UNIQUE_KEY_NAME</overridePrimaryKeys>


This is a bug in the jOOQ code generator:
https://github.com/jOOQ/jOOQ/issues/5103

It appears only in PostgreSQL, when generating POJOs for tables with composite type arrays. I currently don't see a workaround.