Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support insert/update condition on ReadOnlyProperty. [DATACMNS-1737] #2158

spring-projects-issues opened this issue Jun 4, 2020 · 3 comments
status: duplicate


Copy link

spring-projects-issues commented Jun 4, 2020

mxandeco opened DATACMNS-1737 and commented

JPA offers an updatable/insertable property on the @Column annotation to allow a property to be read only on the scope of that statement, spring-data core annotation does not offer that feature. but offer a ReadOnlyProperty that works almost in the same way.


The main different here is that I can't ignore only update statement if I want to, it can be situations when a read only behavior is desired only for updates and not for inserts, looks like would be more natural to include that filter on the @ReadOnlyProperty annotation instead of column?



private Instant createdAt;

That's a realm example I have now, all our audit logic lives in the db, and is set as default or trigger values. but during some old data sync, we need to also set this value manually, what is then ignored by the db trigger, I am using r2dbc at the moment, and can't see a way to implement this with core mapping annotation without having to write code to deal with it

Affects: 2.3 GA (Neumann)

@spring-projects-issues spring-projects-issues added type: bug in: mapping labels Dec 30, 2020
Copy link

mp911de commented Jan 26, 2021

That sounds like a UpdateOnly property. I think we have seen a similar request in Spring Data JDBC. Paging @schauder.

@mp911de mp911de added status: waiting-for-triage and removed in: mapping type: bug labels Jan 26, 2021
Copy link

schauder commented Jan 27, 2021

There is indeed a similar issue for Spring Data JDBC: spring-projects/spring-data-relational#637
It asks for insert only semantics.

Since we are at it, we might want to think about a read after write logic. It is a frequently asked question for JPA how to obtain values generated by the database after an insert/update.

Copy link

schauder commented Feb 8, 2021

We will implement this only for JDBC for which there is spring-projects/spring-data-relational#637

@schauder schauder closed this as completed Feb 8, 2021
@schauder schauder added status: duplicate and removed status: waiting-for-triage labels Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
status: duplicate
None yet

No branches or pull requests

4 participants