> Hi Timo!
>
> I have seen that you are following me on twitter. Don't expect too 
> much info there, as I'm hardly using it :-)
No problem ;)
>
> I have noticed your library QueryDSL some time ago. It looks like an 
> excellent approach of "simulating" LINQ behaviour in Java. Surely one 
> of the best implementations I have seen in the field!
Thanks.
>
> With jOOQ I am trying to go a slightly different path. The DSL is only 
> a side-effect of my main goals: To provide standardisation and ease of 
> access to many vendor-specific SQL features, such as stored 
> procedures, UDTs etc. Also, I want to be able to express the full SQL 
> feature set, including all types of complex query constructs, such as 
> UNION's, nested selects, aliasing, etc.
Querydsl SQL has a similar goal. We also try to support SQL in full form 
with engine specific extensions. UNION support, nested queries and 
aliasing included.
Support for stored procedures is on the roadmap.
>
> For these reasons, integration with JPA/Hibernate, etc is not a 
> primary goal, as these abstraction layers completely hide / ignore 
> advanced SQL constructs, for reasons of simplicity and because they're 
> true OR-Mappers, unlike jOOQ. Nevertheless, supporting JPA2/EJB3.0 
> will be a nice-to-have for jOOQ as well, in the near future. If you 
> agree, I would like to evaluate whether QueryDSL and its JPAQuery 
> might be a good match for such an implementation!
Querydsl has multiple modules
JPA - for JPA based backends using annotated domain classes for class 
generation
JDO - for JDO backends
Lucene - for Lucene
Mongodb - for Mongodb via Morphia
Collections - for collections
SQL - for JDBC based backends (comparable to jOOQ)
IMHO Querydsl SQL has really similar goals like jOOQ. We started with 
the JPA module for a JPA 2 Criteria replacement, but we are using 
Querydsl SQL also in production systems, where full-blown ORM is not the 
right tool.
The general approach of jOOQ feels quite good, but I believe that your 
usage of a static metamodel results in verbose alias constructs. 
Querydsl uses dynamic typed paths for everything, which is conceptually 
simpler and I believe in the end also syntactically lighter.
Here is an alias example in jOOQ :
   // Create table aliases
   Table<TTreeRecord>  parent=  TTree.T_TREE.as("parent");
   Table<TTreeRecord>  child=  TTree.T_TREE.as("child");
   // Create field aliases from aliased table
   Field<String>  parentName=  parent.getField(TTree.NAME).as("parent_name");
   Field<String>  childName=  child.getField(TTree.NAME).as("child_name");
   // Execute the above select
   Record record=  create.select(parentName,  childName)
           .from(parent)
           .join(child).on(parent.getField(TTree.ID).equal(child.getField(TTree.PARENT_ID)))
           .fetchAny();
In Querydsl it would be something like this
QTree parent = new QTree("parent");
QTree child = new QTree("child");
Tuple record = query()
    .from(parent)
    .innerJoin(child).on(parent.id.eq(child.parentId))
    .uniqueResult(new QTuple(parent.name, child.name));
String parentName = record.get(parent.name);
String childName = record.get(child.name);
Just an example that Querydsl is not only about JPA ;) Anyway it's great 
to have new players in the field.
Querydsl supports also DML clauses like jOOQ and has optional 
lightweight ORM/Bean projection extensions for Querydsl SQL.
Cheers
Timo
P.S. Deutsch ist meine Muttersprache, also wir k�nnen auch auf Deutsch 
schreiben.
>
> Cheers
> Lukas
P.S. Deutsch ist meine Muttersprache, also wir können auch auf Deutsch schreiben.
Querydsl SQL has a similar goal. We also try to support SQL in full form with engine specific extensions. UNION support, nested queries and aliasing included.
Support for stored procedures is on the roadmap.
The general approach of jOOQ feels quite good, but I believe that your usage of a static metamodel results in verbose alias constructs. Querydsl uses [...]
The general approach of jOOQ feels quite good, but I believe that your usage of a static metamodel results in verbose alias constructs. Querydsl uses dynamic typed paths for everything, which is conceptually simpler and I believe in the end also syntactically lighter.
SELECT a.x, a.z FROM (SELECT t.x, f(t.y) z FROM t) a
Field<?> z = f(T.Y).as("z"); // f() in this case is a generated stored function...
Table<?> a = create().select(T.X, z).from(T).asTable("a");
create().select(a.getField(T.X), a.getField(z)).from(a);