Skip to content

Issue1502/root whitout id exception #1843

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

Conversation

AndreynRosa
Copy link

#1502 fix when agregate root are whitout id. Add exception

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 27, 2024
@AndreynRosa
Copy link
Author

Hi, if I need to adjust anything in the PR, please let me know. I tried to follow the contributor guide as closely as possible.

Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this fixes the issue.
The problem we want to resolve is that we want two different exceptions:

  1. One exception when the id of an entity with id wasn't set to a non-null value. We already get this. And your PR slightly changes the exception, but changes it under the same circumstances.
  2. A different exception when the entity doesn't have an id at all that could be checked for being null.

You can as a PersistentEntity for its id property and check if that is null for this test.

@@ -447,11 +449,6 @@ private <T> void doDeleteAll(Iterable<? extends T> instances, Class<T> domainTyp

private <T> T afterExecute(AggregateChange<T> change, T entityAfterExecution) {

Object identifier = context.getRequiredPersistentEntity(change.getEntityType())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need to extract the check out of this method.

@schauder
Copy link
Contributor

Superseded by #1855

@schauder schauder closed this Aug 14, 2024
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

Successfully merging this pull request may close these issues.

3 participants