title: Filtering non-primitive types with hibernate
body: <p>In my database I do not delete objects. Instead a soft delete is done. Means a delted flag is set to true. This should be filtered by hibernate using the @Filter annotation. 
  This works but I have the problem that fields are not filtered.</p>
  
  <p>For example I have a child class and a parent class which contains a child. If the child gets deleted and the parent gets loaded the parent object contains the child object (although the deleted flag is set correctly). But I want the child object to be filtered like it works with collections.
  Is there any way to do that? </p>
  
  <p>I tried treating the field like a collecting but this didn't work for me.</p>
  
  <pre><code>@Entity
  @FilterDef(name = deletedFilter, parameters = @ParamDef(name = deletedParam, type = "boolean"))
  @Filter(name = deletedFilter, condition = ":deletedParam = deleted")
  public class Child {}
  
  
  @Entity
  public class Parent {
      @OneToOne
      @Filter(name = deletedFilter, condition = ":deletedParam = deleted")
      private Child child = new Child();
  } 
  </code></pre>