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
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/orUPDATE
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
Thereadonly
flag is a property of the generatedorg.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 aDataType
with thereadonly
flag enabled, then it cannot be enforced. See also features requiring code generation for more details.
References to this page
Feedback
Do you have any feedback about this page? We'd love to hear it!