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 #1708

Closed
3 tasks done
aulea opened this issue Feb 16, 2023 · 0 comments
Closed
3 tasks done

Comments

@aulea
Copy link
Contributor

aulea commented Feb 16, 2023

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.

Task List

  • Steps to reproduce provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Define formula kind of property on Domain class
  2. Use markDirty() to mark whole Domain class dirty
  3. Save the Domain class

Expected Behaviour

Should save without Hibernate warnings

Actual Behaviour

As Hibernate warns about, GORM should not try to include formula kind of property into SQL update/insert clause.
Its warning and Hibernate will exclude it, but it will pollute logs.

Workaround is not to mark the whole Domain as dirty and mark by each field, when needed

Environment Information

  • GORM Version: 7.3.x
  • Grails Version (if using Grails): 5.x

Example Application

https://github.com/aulea/gorm_dirtiness_issue_demo - Contains integration test to demonstrate that marking whole domain class as dirty, which contains formula type of property will cause warning by Hibernate

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

No branches or pull requests

1 participant