You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by Timo Westkämper <ti...@mysema.com> on 2010/10/25 16:11:59 UTC

Type-safe queries for Gora?

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


Re: Type-safe queries for Gora?

Posted by Timo Westkämper <ti...@mysema.com>.
Hi Enis.

Wrapping the programmatic API via Querydsl is quite straight forward I 
believe.

The Lucene and Mongodb integrations use a conversion to programmatic 
queries as well.

What kind of query expressivity do you want to achieve with Gora? Is it 
comparable to Mongodb queries or simpler?

Timo.
> Hi,
>
> Querydsl seems nice indeed. I too dislike dealing with string queries. We
> will be glad to collaborate on this. However, there is no string query
> support yet at Gora. The Query interface is completely programmatic. Do you
> propose to wrap current code with querydsl API ?
>
> Enis
>
> On Mon, Oct 25, 2010 at 5:11 PM, Timo Westkämper<timo.westkamper@mysema.com
>    
>> wrote:
>>      
>    
>> 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
>>
>>
>>      


Re: Type-safe queries for Gora?

Posted by Enis Söztutar <en...@gmail.com>.
Hi,

Querydsl seems nice indeed. I too dislike dealing with string queries. We
will be glad to collaborate on this. However, there is no string query
support yet at Gora. The Query interface is completely programmatic. Do you
propose to wrap current code with querydsl API ?

Enis

On Mon, Oct 25, 2010 at 5:11 PM, Timo Westkämper <timo.westkamper@mysema.com
> wrote:

> 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
>
>