Home

Quaere is an open source, extensible framework that adds a querying syntax reminiscent of SQL to Java applications. Quaere allows you to filter, enumerate and create projections over a number of collections and other queryable resources using a common, expressive syntax.

Selecting all integers that are less than five from an array of integers
Integer[] numbers={5, 4, 1, 3, 9, 8, 7, 2, 0};
Iterable<Integer> lowNumbers=
        from("n").in(numbers).
        where(lt("n",5).
        select("n");

System.out.println("All numbers that are less than five:")
for (Integer n: lowNumbers) {
    System.out.println(n);
}

Quaere detaches queries from the query API used by different queryable resources such as databases, catalogs and other structured data, allowing one language to be used to query numerous resources.

Selecting all customers in the Washington region from a database
// Setup a JPA entity manager...
SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory();
EntityManagerFactory entityManagerFactory = 
    new EntityManagerFactoryImpl(sessionFactory, PersistenceUnitTransactionType.RESOURCE_LOCAL, true);
QueryableEntityManager entityManager = 
    new QueryableEntityManager(entityManagerFactory.createEntityManager());

// Select all customers in the Washington region
Iterable<Customer> waCustomers =
        from("c").in(entityManager.entity(Customer.class)).
        where(eq("c.getRegion()", "WA")).
        select("c");

System.out.println("These customers are located in the Washington region:");
for (Customer c : waCustomers) {
    System.out.println(c.getCompanyName());
}

Mission | History | FAQ

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 06, 2009

    Sergey Armishev says:

    Somebody can tell me where to download this Quaere  project from?

    Somebody can tell me where to download this Quaere  project from?