Readonly column property for generated/virtual columns #5728
MySQL and MariaDB both support virtual/computed/generated columns.
More info on these columns:
This seems to support an edge-case scenario that is DB-specific. Any reason why you can't simply skip mapping those fields?
In addition to that, userland object implementations may still overwrite those field values, leading to out-of-sync db and object model. In addition to that a full entity refresh should be forced if one of those fields is computed.
I think the resolution for this issue is as simple as "don't map it", which will lead the ORM to completely ignore the field anyway.
Tossing in my
A similar solution based on this PR, but not with
Additional conditions: Should throw exception for UPDATE statements attempting to update this field/column.
Could be combined directly by adding
One question would be, if an update or insert is done, then the persister must probably fetch the value of the columns from the database, because they are virtual and might be updated. Example: Auto Increment non ID columns, or timestamps updated on write, trigger based columns.