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

Grails GORM Derived Properties using formulae in subclasses don't work when superclass Domain has tablePerHierarchy false #13030

Open
paulito415 opened this issue Jun 14, 2023 · 0 comments

Comments

@paulito415
Copy link

paulito415 commented Jun 14, 2023

Expected Behavior

Derived Properties should be working as advertised using formula specifications in the static mapping block of any Domain class regardless of whether it is a subclass of another Domain class or whether its superclass has set tablePerHierarchy to be false in its static mapping block.

Actual Behaviour

Derived Properties are not working using formula specifications in the static mapping block of a Domain class that is a subclass of another Domain class which has set tablePerHierarchy to be false in its static mapping block. This means two things:

  • Table Creation of the child Domain class will include the column otherwise meant to not exist because of the existence of its forumla in the static mapping block
  • Evaluation of this property at runtime looks to the database stored value instead of evaluating the formula specified

Steps To Reproduce

See attached project gorm-formula-bug.tar.gz

  1. Install MySQL or MariaDB
  2. Create the Database table schema: sudo mysql -u root < src/main/sql/create-database.sql
  3. Update Configuration again to change dbCreate from update to create-drop
  4. Run the app to seed the schema tables
  5. The bad_parent table should have a column called bmi while the good_parent one does not.
  6. Update Configuration again to change dbCreate from create-drop to update
  7. Run the app to observe log output
  • Child 1 should have null bmi and
  • Child 2 should have a non-null bmi

Environment Information

  • Operating System: Cygwin / AlmaLinux 9.2
  • MariaDB 10.3.14
  • JDK 1.8

Example Application

No response

Version

5.2.5

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