From what I’ve been testing it seems that you can only use standard SQL inside a @Formula annotation. The documentation is not very descriptive about this feature (I’ve found one paragraph about it at most), so I was wondering whether HQL can be used somehow or whether there’s another feature that would let me load an object’s property with a HQL query.
Share
You are right .
@Formulaonly allows to use the actual column name .The important characteristic of HQL is use the java property name to refer the actual column name . If you want to refer the property names when deriving your formula value , you can simply implement the logic of the formula in the getter of your mapped POJOs.