Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16

Readonly columns

Applies to ❌ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

There are various reasons why a column could be readonly, including:

  • The column is formally marked as READONLY, if the database product supports this.
  • The column is from a view, and either the entire view, or just that particular column is not updatable.
  • The user lacks INSERT and/or UPDATE grants to the column.
  • The column is computed using [ GENERATED ALWAYS ] AS <expression> (DEFAULT columns aren't readonly)
  • There is a trigger preventing writing to the column.

jOOQ's code generator can detect some of these, and mark columns as readonly for you, meaning that the column will not be taken into consideration in DML statements, such as INSERT or UPDATE, or UpdatableRecord CRUD calls. To configure the runtime behaviour of such readonly columns, please see the relevant section about readonly columns.

It's also possible to manually mark columns as readonly using the synthetic readonly columns configuration.

Limitations

The readonly flag is a property of the generated org.jooq.DataType. As such, the property can only be enforced on expressions which make this flag available to jOOQ. For example, if you're using plain SQL templates without passing along a DataType with the readonly flag enabled, then it cannot be enforced. See also features requiring code generation for more details.

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo