Package org.hibernate

Examples of org.hibernate.Filter


 
  @SuppressWarnings("unchecked")
  public void testChildWithFilter() {
    session = openSession();
    session.beginTransaction();
    Filter filter = session.enableFilter("age_gt_10");
    filter.setParameter("age", 10);
    System.out.println("testChildWithFilter");
    List<Animal> result = session.createCriteria(Cat.class).list();
    Assert.assertEquals(1, result.size());
    session.getTransaction().commit();
    session.close();
View Full Code Here


  @SuppressWarnings("unchecked")
  public void testParentWithFilter() {
    session = openSession();
    session.beginTransaction();
    Filter filter = session.enableFilter("age_gt_10");
    filter.setParameter("age", 10);
    System.out.println("testParentWithFilter");
    List<Animal> result = session.createCriteria(Animal.class).list();
    Assert.assertEquals(1, result.size());
    session.getTransaction().commit();
    session.close();
View Full Code Here

    checkTransactionSynchStatus();
    // First, validate all the enabled filters...
    //TODO: this implementation has bad performance
    Iterator itr = enabledFilters.values().iterator();
    while ( itr.hasNext() ) {
      final Filter filter = (Filter) itr.next();
      filter.validate();
    }
    return enabledFilters;
  }
View Full Code Here

    s.save( test );

    s.flush();
    s.clear();

    Filter filter = s.enableFilter( "selectedLocale" );
    filter.setParameter( "param", "fr" );

    Query q = s.createQuery( "from TestCourse t" );
    List l = q.list();
    assertEquals( 1, l.size() );
View Full Code Here

TOP

Related Classes of org.hibernate.Filter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.