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

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Readonly column behaviour

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

When using is readonly columns, by default, any values that are attempted to be inserted or updated are ignored. The following Settings allow for overriding and the default behaviour of readonly columns:

Each one of these flags is of type org.jooq.conf.WriteIfReadonly with these permitted states:

  • WRITE: Write to the column as if it weren't readonly. This effectively turns off the feature.
  • IGNORE: Ignore the column in a relevant statement. This is the default.
  • THROW: Throw an exception if the column is included in a relevant DML statement.

The default behaviour IGNORE is particularly useful when loading POJO data into org.jooq.UpdatableRecord and storing it, while ignoring IDENTITY columns, computed columns, synthetic columns (such as the synthetic ROWIDs), and more.

Example configuration

Settings settings = new Settings()
    .withReadonlyInsert(WriteIfReadonly.THROW)                 // Defaults to IGNORE
    .withReadonlyUpdate(WriteIfReadonly.THROW)                 // Defaults to IGNORE
    .withReadonlyTableRecordInsert(WriteIfReadonly.THROW)      // Defaults to IGNORE
    .withReadonlyUpdatableRecordUpdate(WriteIfReadonly.THROW); // Defaults to IGNORE

Feedback

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

The jOOQ Logo