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

[master] Bug 551815: When an entity with an aggregate with all fields set to null is changed to null for the aggregate field then Eclipselink executes a bogus no-op SQL update statement #536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eperez
Copy link

@eperez eperez commented Sep 17, 2019

No description provided.

… set to null is changed to null for the aggregate field then Eclipselink executes a bogus no-op SQL update statement

Signed-off-by: Eduardo Perez Ureta <edpeur@gmail.com>
return true;
}
final Set<java.lang.reflect.Field> fields = getAllFields(new HashSet<java.lang.reflect.Field>(), o.getClass());
for (final java.lang.reflect.Field f : fields) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If Object o is not null and contains no fields, then return true?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that is intended as there should not be any difference. Do you see any problem in that behavior?

@lukasj
Copy link
Member

lukasj commented Sep 18, 2019

How does this deal with fields marked '@transient'? What if app uses annotations on methods and not on fields? ie eclipselink can trigger getter which in turn returns something different from what is stored in the field..

Copy link
Member

@lukasj lukasj left a comment

Choose a reason for hiding this comment

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

instead of direct reflection, appropriate accessors and possibly objectbuilder should be used

@eperez
Copy link
Author

eperez commented Sep 19, 2019

instead of direct reflection, appropriate accessors and possibly objectbuilder should be used

@lukasj I have changed the code to use ObjectBuilder instead. Is it OK now?

@eperez eperez force-pushed the bugfix/simple-aggregate-null branch from fc72bd2 to 194db07 Compare October 6, 2019 08:11
@eperez eperez changed the title Bug fix: When saving an entity, that was saved with an aggregate object that contains null values, with a null value for an aggregate then EclipseLink will still generate an update record for that record field changing it from NULL to NULL, but it should not do that as there was no change. [master] Bug 551815: When an entity with an aggregate with all fields set to null is changed to null for the aggregate field then Eclipselink executes a bogus no-op SQL update statement Oct 6, 2019
@eperez eperez force-pushed the bugfix/simple-aggregate-null branch from 194db07 to 0addc8c Compare October 6, 2019 09:12
@rfelcman
Copy link
Contributor

rfelcman commented Nov 4, 2019

Could You please fix year in the copyright header:

  1. In case of new files (just creation year) e.g.:
    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
  2. In case of modified files (creation year, modification year) e.g.:
    Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.

same case for #606

@eperez eperez force-pushed the bugfix/simple-aggregate-null branch 2 times, most recently from c7d2d4c to a407560 Compare November 4, 2019 20:07
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.

None yet

4 participants