title: Default conditions on Hibernate filters
body: <p>I'm defining a Hibernate filter which specifies a default condition as follows:</p>
  
  <pre><code>&lt;filter-def name="IsDeletedFilter" condition="IsDeleted = 'false'" /&gt;
  </code></pre>
  
  <p>Within my entity mapping, I associate the filter like this:</p>
  
  <pre><code>&lt;filter name="IsDeletedFilter" /&gt;
  </code></pre>
  
  <p>According to the <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/filters.html" rel="nofollow noreferrer">documentation</a>, 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:</p>
  
  <blockquote>
    <p>Caused by: java.lang.NullPointerException
    at org.hibernate.cfg.HbmBinder.parseFilter(HbmBinder.java:2957)</p>
  </blockquote>
  
  <p>If, however, I specify the condition directly in the entity mapping like this:</p>
  
  <pre><code>&lt;filter name="IsDeletedFilter2" condition="IsDeleted = 'false'"/&gt;
  </code></pre>
  
  <p>it works fine and the data is getting filtered correctly.</p>
  
  <p>What's the right way to use default conditions?</p>