Skip to content
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

Weird behavour when using bidirectional oneToMany in combination with jpa postload #3750

Open
JaimePolidura opened this issue Jan 24, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@JaimePolidura
Copy link

Hello,

I',m unsure if this is project is the correct place to report the following behavour I've observed, please let me know if I should report it to another github project.

With the latest spring boot 3.4.x version, I have observed the following problem in my springboot project that uses spring data jpa to persist againsts postgres database. I have created a small springboot project to reproduce this bug github project

  • I have a parent entity with a oneToMany relationship to a child entity.
  • In the child entity I have a bidirectional manyToOne relationship to the parent.
  • Aditionally in the parent I have a jpa @PostLoad annotation where I just sort the list of children by an integer field.
  • I have added a spring boot test to persist a parent whith three children, and then load all children from database.
  • For your convenience, the pom.xml includes docker-maven-plugin to start postgres via docker, please use the following command: mvn docker:start -Pdocker

The test throws an exception because of during the postload in the list of children the first child's fields are null, interestingly other children have fields with values as expected, please see screenshot:

Image

I have added a feature branch in my project revert-to-old-springboot where I use spring boot 3.3.x instead and the test is successful and the bug does not appear.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants