Hi everybody,
I have a simple test application with @Filter feature. The problem is the filter don`t work (resulting SQL do not include filter condition).
The entity:
@Entity
@Table(name = "test_a_table")
@FilterDef(name = "valueTest")
@Filter(name = "valueTest", condition = "(value = 'test')")
public class A {
@Id
@Column
private String id;
@Column
private String value;
...
}
@Stateless
public class ADaoImpl implements ADao {
@PersistenceUnit
private EntityManagerFactory emf;
public Session getSession() {
return (Session) emf.createEntityManager().getDelegate();
}
public List<A> getAll() {
getSession().enableFilter("valueTest");
return getSession()
.createCriteria(A.class)
.list();
}
....
}
/* criteria query */ select this_.id as id72_0_, this_.value as value72_0_ from test_a_table this_
I am having this same problem. Did you get teh @Filter to work?