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

GORM should not check Entity's dirtiness on formula and transient type of properties #1697

Merged

Conversation

aulea
Copy link
Contributor

@aulea aulea commented Nov 24, 2022

Fix for issue #1708

When using "formula" kind of property on GORM entity and marking whole class as dirty, then during entity's save GORM Hibernate will want to include "formula" also into update clause. Hibernate ignores it, but started to log about such situations on WARN level: "HHH000502: The [formula_kind_property_name] property of the [entity_class_name] entity was modified, but it won't be updated because the property is immutable." For workaround, I will make sure that only changed properties are marked dirty and will not use method to mark whole class as dirty. But it would be nice to be able to use markDirty on whole class, with formulas.

It could be handled at GORM Hibernate side, but I decided to handle it on GORM side - not to tell/track changes for derived(ex. formula) and transient properties.

For GORM entities, dirtiness check is added "manually" during AST transformation, not through trait (fix for #1126). So I couldn't simply extend or override dirty checks in GormEntity trait. That's why I created new trait GormEntityDirtyCheckable, which i will add "manually" during AST transformation. Maybe someone who is better in metaprogramming/tranformation could do it with the trait.

@puneetbehl
Copy link
Contributor

Thank you for the pull request. Can you please open an issue describing the problem and steps to replicate it?

@puneetbehl puneetbehl merged commit 26f98f9 into grails:7.3.x Feb 27, 2023
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

2 participants