Hi!
I'm trying to use a calculated property (formula) but had only luck with simple things like adding up attributes:
Assuming a class that has the quantity, unit_cost and unit_labor attributes, this will work:
Code:
<property formula="quantity * (unit_cost+ unit_labor)" />
But I would like to perform an SQL query like the following, which doesnt work.
Code:
select sum (quantity * (unit_cost+ unit_labor)) from table_X
From my understanding the documentation for
http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapping-s1-7 Hibernate 2.1 (the version I'm using) talk about formula beign an SQL expression... but its not really clear on the semantics, variable scope etc...
Any ideas or workarounds?