<property>元素的formula 属性指定一个sql表达式,该表达式可以引用表的字段,调用 sql 函数 或者 包含子查询语句。
例 :
<property name ="totalPrice" formula="(select sum(o.PRICE) from ORDERS o where o.DUSTOMER_ID=ID)" />
sql: select ID,NAME , (select sum(o.PRICE) from ORDERS o where o.DUSTOMER_ID=ID) from CUSTOMERS
<property name ="unitPrice" formula="BASE_PRICE*QUANTITY" />
select ID,BASE_PRICE*QUANTITY from LINEITEM