incubator-gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timo Westkämper <timo.westkam...@mysema.com>
Subject Type-safe queries for Gora?
Date Mon, 25 Oct 2010 14:11:59 GMT
Hello everybody.

I am the maintainer of Querydsl, a typesafe query language for Java. 
Querydsl supports backends like JPA, JDO, SQL, Lucene and Mongodb and we 
would like to know if you guys would like to collaborate on bringing 
type-safe query support to Gora.

The benefits of using Querydsl in comparison to string based queries are

    * code completion in IDE
    * almost no syntactically invalid queries allowed (type-safe on all
      levels)
    * domain types and properties can be referenced safely (no Strings
      involved!)
    * adopts better to refactoring changes in domain types
    * incremental Query definition is easier

The homepage of Querydsl provides basic information on our project : 
http://source.mysema.com/display/querydsl/Querydsl

Querydsl uses APT processors to scan for annotated domain types and 
generates a Query model based on the annotated sources. The query model 
can then be used to construct queries.

Here is an example for JPA

QCustomer customer = QCustomer.customer; // query model type
JPQLQuery query =new  HibernateQuery (session); // query instance
Customer bob = query.from(customer)
   .where(customer.firstName.eq("Bob"))
   .uniqueResult(customer);


What do you think?

Best regards,
Timo Westkämper


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message