-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Kotlin with Spring Boot 3 entity inheritance issue #2867
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
Comments
Sounds like spring-projects/spring-data-commons#1911. |
I will try this version |
The commit is tagged 3.1.0-M2 but doesn't seem to be included? @christophstrobl |
Anyway. I updated my example to spring-data-jpa/commons 3.1.0-M2 and still getting the same result |
This sounds very much like a Hibernate issue, since all the JPA mapping is done by it. If you think this is actually a Spring Data issue, please provide a reproducer for the issue including a test case that demonstrates the correct behaviour using the |
@schauder @christophstrobl With pure Hibernate it works as expected with inheritance. |
Thanks for the test. Yes, that seems to demonstrate that the problem is on our side. |
@schauder This topic didn't let me loose. Here is the link to the hibernate issue https://hibernate.atlassian.net/browse/HHH-15874 |
Thanks for the work on this. Closing this issue as it is not a Spring Data problem. |
This worked for me when changing all affected data class constructor fields to |
I found a some kind of weird behaviour with loading inherited entities.
I created an example project with one entity that extends another (with @Intehitance annotation) to prove the point. https://github.com/jan-schumacher/KotlinJpaInheritanceIssue
After loading the entity the overridden fields were not loaded correctly. They seem to be put inside the parent class instead of the child. In the debugger it looks like seen in the screenshot.

When loading result.value2 it's always null.
I overloaded the getter of value1 to load
super.name
which works and proves the point but is obviously not a good solution.When switching back and forth between Spring Boot 2.7.6 and Spring Boot 3.0.4 this implementation only works in 2.7.6
The text was updated successfully, but these errors were encountered: