I'm defining a Hibernate filter which specifies a default condition as follows:
<filter-def name="IsDeletedFilter" condition="IsDeleted = 'false'" />
Within my entity mapping, I associate the filter like this:
<filter name="IsDeletedFilter" />
According to the documentation, the filter should apply the default condition when used this way. When I try to do this, however, Hibernate throws a NullPointerException when it tries to parse the entity mapping. The stack trace shows this:
Caused by: java.lang.NullPointerException at org.hibernate.cfg.HbmBinder.parseFilter(HbmBinder.java:2957)
If, however, I specify the condition directly in the entity mapping like this:
<filter name="IsDeletedFilter2" condition="IsDeleted = 'false'"/>
it works fine and the data is getting filtered correctly.
What's the right way to use default conditions?