gorm-hibernate5
gorm-hibernate5 copied to clipboard
Derived fields with formula not working
Steps to Reproduce
I've created a simple demo app which shows my problem. I tried to use a derived field in one of my domain classes using formula in mapping closure. I want to use a subselect to a view. I cannot use some kind of size() method oder something like this in my real app for some special reasons.
I thought I don't have to use transients for this field. But if I omit this, gorm creates a column in my table for property projectCount.
Expected Behaviour
I just want grails/gorm to use my sql statement under formula to be executed if i read the property projectCount of my domain class Person.
Actual Behaviour
The sql statement is never executed and the value of the property projectCount is always 0.
Environment Information
Operating System: Mac OSX 10.14.5 GORM Version: 6.1.11.RELEASE Grails Version (if using Grails): 3.3.10 JDK Version: OpenJDK 64-Bit Server VM (Zulu 8.38.0.13-CA-macosx) (build 25.212-b04, mixed mode)
Example Application
An small example project could be found at https://github.com/cgoIT/grails-formula-bug
Thanks for the PR, we will take a look
+1 can reproduce in my project. will there be any action on this?
I ran into the same issue.