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
java.lang.Long cannot be cast to java.time.LocalDateTime related to HHH-12460 #122
Comments
drenda
changed the title
ava.lang.Long cannot be cast to java.time.LocalDateTime related to HHH-12460
java.lang.Long cannot be cast to java.time.LocalDateTime related to HHH-12460
Apr 5, 2018
This will be fixed by https://jira.spring.io/browse/DATACMNS-1290 |
Thanks. I'll look forward the fix. |
schauder
added a commit
to spring-projects/spring-data-commons
that referenced
this issue
Apr 6, 2018
The type long or Long is actually required for custom revision entities by Envers. See also: spring-projects/spring-data-envers#122
mp911de
pushed a commit
to spring-projects/spring-data-commons
that referenced
this issue
Apr 9, 2018
The type long or Long is actually required for custom revision entities by Envers. See also: spring-projects/spring-data-envers#122 Original pull request: #282.
mp911de
pushed a commit
to spring-projects/spring-data-commons
that referenced
this issue
Apr 9, 2018
The type long or Long is actually required for custom revision entities by Envers. See also: spring-projects/spring-data-envers#122 Original pull request: #282.
Closing this as the JIRA issue is resolved. |
denis554
added a commit
to denis554/spring-data-commons
that referenced
this issue
Mar 21, 2019
The type long or Long is actually required for custom revision entities by Envers. See also: spring-projects/spring-data-envers#122 Original pull request: #282.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using Spring Boot 2 with Spring Data Envers 2.0.6 and Hibernate 5.2.16. My application worked fine with Spring 1.5.x and Hibernate 5.2.15 and Spring Data Envers, but after the migration to Spring Boot 2 I've this problem.
I customized RevisionEntity my because I want that Hibernate use an autoincrement column rather than a hibernate_sequence table:
In this way Hibernate uses the autoincrement value of the column id in RevInfo rather than hibernate_sequence.
Then I've a specific method to get revision using Spring Data Envers (I'm using 2.0.6.RELEASE):
org.springframework.data.history.Revision (the object I'm using above) defines the method getRevisionDate() in this way:
So I'm legitimated to assume that that line will return a LocalDateTime, BUT at runtime this is what happens:
Debugging I saw that the value revision.getRevisionDate().get() is not a LocalDateTime but it is a Long. I'm not really sure where is the problem but I saw that the class then is being used at runtime when I'm not extending DefaultRevisionEntity is https://github.com/spring-projects/spring-data-commons/blob/master/src/main/java/org/springframework/data/history/AnnotationRevisionMetadata.java, but the implementation in the release 2.0.6 is different: it is this:
I opened a ticket on Hibernate Jira HHH-12460 but they said it seems more a Spring related thing.
I hope in some hint.
The text was updated successfully, but these errors were encountered: