spring-projects / spring-projects/spring-data-couchbase
Getting java.lang.String cannot be cast to java.lang.Long exception
Open
@mikereiche is already working on this.
Since Oct 2, 2024.
type: regression
- Dominant language
- Java
- Stars
- 284
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
I am getting this exception (java.lang.String cannot be cast to java.lang.Long) when I have the version field declared as String and annotated with org.springframework.data.annotation.Version
@Version
private String version;
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
02:20:35,571 INFO [stdout] (membershipChangeScheduler_Worker-2) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) ~[spring-data-couchbase-4.4.0.jar:4.4.0]
The way the version field is being type casted has changed from spring-data-couchbase 3.2.x to 4.4.x in the save method (and probably other places as well which I might not be aware of)
Is there something we can do to help us migrate from 3.x to 4.x by avoiding this error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.