例如: <property name="averagePrice" formula="(select avg(pc.price) from PriceCatalogue pc, SelectedItems si where si.priceRefID=pc.priceID)"/>
而且,formula也有助于從另一表中通過當(dāng)前記錄的某個屬性值來獲取數(shù)據(jù)。例如: <property name="currencyName" formula="(select cur.name from currency cur where cur.id= currencyID)"/>