Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Yeah you are right. I had the Version field in the entity. I never knew Spring Data JPA would look for that field. Commented Jul 27, 2015 at 2:38
  • 1
    Thanks for this answer I came across the same issue! Commented Dec 20, 2017 at 6:26
  • 1
    In regards to the issue with @Version, I got around that by adding the Java Validation @Null annotation, assigning a low default value to the version field, and removing the setter for the version field. That way the field is never null. I am using an Instant class as the @Version field. Commented Dec 21, 2017 at 15:38
  • Thanks for the answer I put this column and I forget to set a default value when i insert from SQL, it took me one day to solve. Thanks mate. Commented Jan 23, 2023 at 9:50
  • I believe this exact behaviour is documented here: docs.spring.io/spring-data/jpa/reference/jpa/… Commented Dec 11, 2023 at 17:41