session.enableFilter("region").setParameter("region", "Foobar");
departments = session.createQuery("select d from Department as d where d.id in (select s.department from Salesperson s where s.name = ?)").setString(0, "steve").list();
assertEquals("Incorrect department count", 0, departments.size());
session.enableFilter("region").setParameter("region", "APAC");
List orders = session.createQuery("select o from Order as o where exists (select li.id from LineItem li, Product as p where p.id = li.product and li.quantity >= ? and p.name = ?) and o.buyer = ?")
.setLong(0, 1L).setString(1, "Acme Hair Gel").setString(2, "gavin").list();
assertEquals("Incorrect orders count", 1, orders.size());