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