-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Different behavior between Spring Boot 3.0.5 & 2.7.10, when using @EntityGraph with @ElementCollection/@CollectionTable #2894
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
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 What Hibernate versions that Spring Boot 3.0.5 & 2.7.10 use? Also, I don't know how to use Hibernate API that corresponds to |
3.0.5 uses Hibernate 6.1.7 See: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa/2.7.10 For how to use a fetch graph there is a decent description at The hint names are defined in Hibernates |
I couldn't figure out how to replicate the issue using JPA API only. Using Spring Boot 3.0.5, and given:
How to make |
I was able to replicate the bug using JPA API:
This returns 2 roles in |
Submitted a bug report to Hibernate team: https://hibernate.atlassian.net/browse/HHH-16408 |
Thanks for the confirmation. |
This bug should be fixed in Hibernate 6.2.0: https://hibernate.atlassian.net/jira/software/c/projects/HHH/issues/HHH-15964 |
I have this field inside
UserEntity
:and I have this method inside
UsersRepository
:On Spring Boot v3.0.5,
user.getRoles()
always contain single role despite the user has multiple roles. On Spring Boot v2.7.10,user.getRoles()
works as expected and it contains all assigned roles.Here is a reproducer: https://github.com/Eng-Fouad/spring-entity-graph-bug
The text was updated successfully, but these errors were encountered: