Derived fields with formula not working
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### 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](https://github.com/cgoIT/grails-formula-bug)
Contributor guide
Assessment
This issue has not been assessed yet.