1 Reply Latest reply on Dec 11, 2008 9:49 AM by jfrankman

    @Filter don`t work on jboss

    bmc

      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)