Hi all -
This seems simple but I don't see any examples. I am trying to set up a Filter using annotations, to implement a soft-delete scheme.
Here is the definition:
Code:
// To my understanding, this is a global definition and can appear in any mapped @Entity
@FilterDef(name="filterDeleted", defaultCondition="deleteDate is null",parameters={})
...
// The @Filter declaration I have tried on the property definition and on the target class
@OneToMany(mappedBy="question",fetch=FetchType.EAGER,cascade=CascadeType.ALL)
@Filter(name="filterDeleted")
public List<Answer> getAnswers() {
return answers;
}
...and activated from a generic Dao as...
Code:
Filter filter = hbmSession.enableFilter("filterDeleted");
However, this configuration has no effect. The Filter is ignored and nothing is logged.
Every example I've seen around includes a parameter in the condition. Is this required? What I hope to achieve is a fetch method in the dao ignoring deleted records. As a fetch, it only gets a primary key, i.e. get(Long).
Can anyone see something missing here? Thanks for any ideas.