I belive you could use a "formula" or computed property using "select count(*) from table where [where condition]" as the formula
http://www.hibernate.org/hib_docs/refer ... pping-s1-7
(excerpt)
Code:
<property
name="propertyName"
column="column_name"
type="typename"
update="true|false"
insert="true|false"
formula="arbitrary SQL expression"
access="field|property|ClassName"
/>
...
Code:
formula (optional): an SQL expression that defines the value for a computed property. Computed properties do not have a column mapping of their own.