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:
Code:
@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;
...
}
DAO:
Code:
@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();
}
....
}
Result Code:
Code:
/* criteria query */ select
this_.id as id72_0_,
this_.value as value72_0_
from
test_a_table this_
Here is maven project zipped:
http://6709.su/test.zip (8KB)
PS: Jboss 4.2.2.GA (hibernate 3.2.4.sp1)