[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - @Filter don`t work on jboss

bmc do-not-reply at jboss.com
Mon Sep 1 07:27:00 EDT 2008


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;
  | 
  |     ...
  | }
  | 

DAO: 

  | @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 SQL 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)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173587#4173587

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173587



More information about the jboss-user mailing list