Hibernate version: 3.1.3
Name and version of the database you are using: MySQL 5.0
I've had a filter defined for one of my entities for quite a while and thought it was working perfectly. It turns out it is only being applied when I run a query against that entity [eg, Criteria.list()]; it is not applied if I load an entity instance directly via Session.get(). This surprises me and causes me quite a problem (for reasons that I can go into if need be).
Am I misunderstanding how filters are intended to work? And if so, is it documented somewhere? (I've read and re-read chapter 17 of the reference manual)
All my Hibernate code goes through a helper that automatically calls Session.enableFilter(), and here's the relevant part of my mapping XML:
Code:
<hibernate-mapping ...>
<class name="Document" ...>
...
<property name="isPrivate" type="boolean" not-null="true" />
...
<filter name="nonPrivateDocuments" />
</class>
<filter-def name="nonPrivateDocuments" condition="not isPrivate" />
</hibernate-mapping>
TIA,
Eric