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 columns
Applies to ❌ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
jOOQ's code generator may decide that a column is readonly, in case of which using it in various DML statements may change. By default, INSERT
, or UPDATE
operations on such columns are simply ignored.
INSERT INTO MY_TABLE (ID) -- READONLY_COLUMN is ignored VALUES (1);
create.insertInto(MY_TABLE) .columns(MY_TABLE.ID, MY_TABLE.READONLY_COLUMN) .values(1, 1) .execute();
This also affects any UpdatableRecord call:
INSERT INTO MY_TABLE (ID) -- READONLY_COLUMN is ignored VALUES (1);
MyTableRecord rec = create.newRecord(MY_TABLE); rec.setId(1); rec.setReadonlyColumn(1); rec.store();
The default behaviour of readonly
columns in INSERT and UPDATE statements can be overridden with these 4 readonly settings:
-
Settings.readonlyInsert
: Behaviour ofreadonly
columns in anINSERT
context. -
Settings.readonlyUpdate
: Behaviour ofreadonly
columns in anUPDATE
context. -
Settings.readonlyTableRecordInsert
: Behaviour ofreadonly
columns in aTableRecord.insert()
context. -
Settings.readonlyUpdatableRecordUpdate
: Behaviour ofreadonly
columns in anUpdatableRecord.update()
context.
For more details about the settings, refer to the page about readonly settings
References to this page
Feedback
Do you have any feedback about this page? We'd love to hear it!