Package org.hibernate

Examples of org.hibernate.Session.disableFilter()


    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
    s.close();
  }

  public void testParameterizedType() throws Exception {
View Full Code Here


    s = openSession();
    tx = s.beginTransaction();
    s.enableFilter( "betweenLength" ).setParameter( "minLength", 5 ).setParameter( "maxLength", 50 );
    long count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).intValue();
    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
View Full Code Here

    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
    s.close();
  }

  public void testParameterizedType() throws Exception {
View Full Code Here

    s = openSession();
    tx = s.beginTransaction();
    s.enableFilter( "betweenLength" ).setParameter( "minLength", 5 ).setParameter( "maxLength", 50 );
    long count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).intValue();
    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
View Full Code Here

    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
    s.close();
  }

  public void testParameterizedType() throws Exception {
View Full Code Here

    s = openSession();
    tx = s.beginTransaction();
    s.enableFilter( "betweenLength" ).setParameter( "minLength", 5 ).setParameter( "maxLength", 50 );
    long count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).intValue();
    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
View Full Code Here

    assertEquals( 1, count );
    s.disableFilter( "betweenLength" );
    s.enableFilter( "minLength" ).setParameter( "minLength", 5 );
    count = ( (Long) s.createQuery( "select count(*) from Forest" ).iterate().next() ).longValue();
    assertEquals( 2l, count );
    s.disableFilter( "minLength" );
    tx.rollback();
    s.close();
  }

  public void testParameterizedType() throws Exception {
View Full Code Here

    Salesperson sp = ( Salesperson ) salespersons.get( 0 );
    assertEquals( "Incorrect order count", 1, sp.getOrders().size() );

    session.clear();
   
    session.disableFilter("regionlist");
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[]{"LA", "APAC", "APAC"} );
    // Second test retreival through hql with the collection as non-eager with different region list
    salespersons = session.createQuery( "select s from Salesperson as s" ).list();
    assertEquals( "Incorrect salesperson count", 1, salespersons.size() );
    sp = ( Salesperson ) salespersons.get( 0 );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.