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 update by field when entity parameter is present #3140

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Conversation

radovanradic
Copy link
Contributor

Fix for issue #3139

@@ -170,12 +170,12 @@ protected <T> Predicate interceptPredicate(MethodMatchContext matchContext,
final SourcePersistentEntity rootEntity = (SourcePersistentEntity) root.getPersistentEntity();
Predicate predicate = null;
if (entityParameter != null) {
if (rootEntity.getVersion() != null) {
if (rootEntity.getVersion() != null && existingPredicate == null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It appears this is used for void update(Entity entity) too but also for void updateByField(String field, Entity entity) so when there is existing predicate with entity parameter we shouldn't add id and version criteria.

Copy link

sonarcloud bot commented Sep 19, 2024

@dstepanov dstepanov merged commit af88d15 into 4.9.x Sep 20, 2024
53 checks passed
@dstepanov dstepanov deleted the fix-update-by branch September 20, 2024 07:22
@radovanradic radovanradic added the type: bug Something isn't working label Sep 20, 2024
@radovanradic radovanradic linked an issue Sep 20, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UpdateBy* doesn't work anymore in micronaut-data:4.8
2 participants