db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timo Westkämper <timo.westkam...@mysema.com>
Subject Re: Minutes: JDO TCK Conference Call Friday, June 5, 9 am PDT
Date Fri, 05 Jun 2009 19:43:37 GMT

Some comments on the Querydsl aspects :
> Attendees: Michelle Caisse, Michael Bouschen, Craig Russell
> Agenda:
> 1. JDOQL & Querydsl: looks interesting, along the lines of JPA except 
> JPA uses Java 6 APT whereas it looks like Querydsl uses a static 
> preprocessor. Not much of a difference; Querydsl could use the APT 
> approach as well. The big advantage in both approaches is compile-time 
> checking.
Querydsl uses Java 6 APT. But we provide support for Java 5 APT as well.

> Looks simple at first glance. But what does it look like with more 
> complex queries like joins, projections, collection navigation, maps, 
> subselects, etc.? How well does it cover the JDOQL query space?
Collection and Map navigation is supported, and subselects are at least 
supported in the JPAQL/HQL module, haven't tested it with JDOQL.

Examples of more complex queries will be in the tests and documentation 
of the next release.

Here is a comparison of queries I posted on Linda de Michiel's JPA 2 

JPA 2 query :

QueryBuilder qb = ...
CriteriaQuery q = qb.create();
Root<Customer> cust = q.from(Customer.class);
Join<Customer, Order> order = cust.join(Customer_.orders);
Join<Order, Item> item = order.join(Order_.lineitems);

Querydsl query (for HQL) : 

HQLQuery query = new HQLQueryImpl(session);
QCustomer cust = QCustomer.customer; 
QOrder order = QOrder.order; 
QLineItem lineItem = QLineItem.lineItem;

List<String> customerNames = query.from(cust) 
  .innerJoin(cust.orders, order)
  .innerJoin(order.lineitems, lineItem)

(QCustomer, QOrder and QLineItem are Querydsl metamodel types, they are immutable and can
be reused over queries)

JPAQL query :

SELECT c.name
FROM Customer c JOIN c.orders o JOIN o.lineitems i
WHERE i.product.productType = 'printer'

Compare the filter expression of JPA 2


with the Querydsl version


Timo Westkämper / Mysema Ltd

View raw message