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

fix: calling scheduleForInsert twice #11835

Open
wants to merge 3 commits into
base: 2.20.x
Choose a base branch
from

Conversation

gseidel
Copy link

@gseidel gseidel commented Feb 14, 2025

If scheduleForInsert was called in prePersist hook already, then persistNew need to check this case first, otherwise a ORMInvalidArgumentException will be thrown.

Describing my use case:

Trying to implement some "two column polymorphism", see discusson #9928.
So I want to call a persist on an unmapped property. This works fine for most cases. But if the entity inside the unmapped property has some cascade persist to the entity carrying the unmapped property, then the scheduleForInsert will be called twice. Once for the cascading inside the hook and later on the persistNew which called the hook at first. You may see the use case on the provided functional test.

If scheduleForInsert was called in prePersist hook already, then persistNew need to check this case first, otherwise a ORMInvalidArgumentException will be thrown
@gseidel
Copy link
Author

gseidel commented Feb 14, 2025

I originally started at branch 3.3.x, but the bug exists also in 2.x. I just saw now, that the tests not working at 2.x. Before I fix the test I will wait for some review to fix all at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant