Examples of enableFilter()


Examples of org.hibernate.Session.enableFilter()

    orders = session.createQuery("select o from Order as o where exists (select li.id from LineItem li where li.quantity >= :quantity and li.product in (select p.id from Product p where p.name = :name)) and o.buyer = :buyer")
        .setLong("quantity", 1L).setString("name", "Acme Hair Gel").setString("buyer", "gavin").list();

    assertEquals("Incorrect orders count", 1, orders.size());

    session.enableFilter("region").setParameter("region", "APAC");
    session.enableFilter("effectiveDate").setParameter("asOfDate", testData.lastMonth.getTime());

    orders = session.createQuery("select o from Order as o where exists (select li.id from LineItem li where li.quantity >= ? and li.product in (select p.id from Product p where p.name = ?)) and o.buyer = :buyer")
        .setLong(0, 1L).setString(1, "Acme Hair Gel").setString("buyer", "gavin").list();
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

        .setLong("quantity", 1L).setString("name", "Acme Hair Gel").setString("buyer", "gavin").list();

    assertEquals("Incorrect orders count", 1, orders.size());

    session.enableFilter("region").setParameter("region", "APAC");
    session.enableFilter("effectiveDate").setParameter("asOfDate", testData.lastMonth.getTime());

    orders = session.createQuery("select o from Order as o where exists (select li.id from LineItem li where li.quantity >= ? and li.product in (select p.id from Product p where p.name = ?)) and o.buyer = :buyer")
        .setLong(0, 1L).setString(1, "Acme Hair Gel").setString("buyer", "gavin").list();

    assertEquals("Incorrect orders count", 1, orders.size());
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    // first a control-group query
    List result = session.createQuery( queryString ).setParameter( 0, "steve" ).list();
    assertEquals( 2, result.size() );

    // now lets enable filters on Order...
    session.enableFilter( "fulfilledOrders" ).setParameter( "asOfDate", testData.lastMonth.getTime() );
    result = session.createQuery( queryString ).setParameter( 0, "steve" ).list();
    assertEquals( 1, result.size() );

    // now, lets additionally enable filter on Salesperson.  First a valid one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "APAC" } );
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    session.enableFilter( "fulfilledOrders" ).setParameter( "asOfDate", testData.lastMonth.getTime() );
    result = session.createQuery( queryString ).setParameter( 0, "steve" ).list();
    assertEquals( 1, result.size() );

    // now, lets additionally enable filter on Salesperson.  First a valid one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "APAC" } );
    result = session.createQuery( queryString ).setParameter( 0, "steve" ).list();
    assertEquals( 1, result.size() );

    // ... then a silly one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "gamma quadrant" } );
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "APAC" } );
    result = session.createQuery( queryString ).setParameter( 0, "steve" ).list();
    assertEquals( 1, result.size() );

    // ... then a silly one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "gamma quadrant" } );
    result = session.createQuery( queryString ).setParameter( 0, "steve" ).list();
    assertEquals( 0, result.size() );

    session.getTransaction().commit();
    session.close();
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    // first a control-group query
    List result = session.createQuery( queryString ).setParameter( "salesPersonName", "steve" ).list();
    assertEquals( 2, result.size() );

    // now lets enable filters on Order...
    session.enableFilter( "fulfilledOrders" ).setParameter( "asOfDate", testData.lastMonth.getTime() );
    result = session.createQuery( queryString ).setParameter( "salesPersonName", "steve" ).list();
    assertEquals( 1, result.size() );

    // now, lets additionally enable filter on Salesperson.  First a valid one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "APAC" } );
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    session.enableFilter( "fulfilledOrders" ).setParameter( "asOfDate", testData.lastMonth.getTime() );
    result = session.createQuery( queryString ).setParameter( "salesPersonName", "steve" ).list();
    assertEquals( 1, result.size() );

    // now, lets additionally enable filter on Salesperson.  First a valid one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "APAC" } );
    result = session.createQuery( queryString ).setParameter( "salesPersonName", "steve" ).list();
    assertEquals( 1, result.size() );

    // ... then a silly one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "gamma quadrant" } );
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "APAC" } );
    result = session.createQuery( queryString ).setParameter( "salesPersonName", "steve" ).list();
    assertEquals( 1, result.size() );

    // ... then a silly one...
    session.enableFilter( "regionlist" ).setParameterList( "regions", new String[] { "gamma quadrant" } );
    result = session.createQuery( queryString ).setParameter( "salesPersonName", "steve" ).list();
    assertEquals( 0, result.size() );

    session.getTransaction().commit();
    session.close();
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    session.getTransaction().commit();
    session.close();

    session = openSession();
    session.beginTransaction();
    session.enableFilter( "region" ).setParameter( "region", "NA" );
    int count = session.createQuery( "delete from Salesperson" ).executeUpdate();
    assertEquals( 1, count );
    session.delete( sp2 );
    session.getTransaction().commit();
    session.close();
View Full Code Here

Examples of org.hibernate.Session.enableFilter()

    session.getTransaction().commit();
    session.close();

    session = openSession();
    session.beginTransaction();
    session.enableFilter( "region" ).setParameter( "region", "NA" );
    int count = session.createQuery( "delete from Salesperson" ).executeUpdate();
    assertEquals( 1, count );
    session.delete( sp2 );
    session.getTransaction().commit();
    session.close();
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.