With MariaDB 10.2 it's possible to define default value for Datetime e.g. created and lastModified.
How I should access this columns as readonly field? Because this values should only be under control of the database and should not be modified from code, but I want read access to this property in code.
It's simple. Just set the insertable
and updatable
attributes to false
.
@Column(
name = "created_on",
insertable = false,
updatable = false
)
private Timestamp createdOn;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With