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

三世轮回 提交于 2019-12-03 01:31:21

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.

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!