The find method in JPA only accepts primary key, is there a way to include the Version property to find the entity.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why would you want to use the version property to find an entity? If you’re using a surrogate primary key field (as recommended by Hibernate) you should be able to identify a row by the id alone.
The Version field is used by hibernate to ensure that a loaded entity is not changed between loading and persisting.
If you really wanted to use the id and version you would need a query: