I'm using QueryDSL with JPA2 for some time, and it's the most powerful combination for ORM I know. JPA Criteria API is a disaster. With QueryDSL I've forgotten about JPQL too.
I'd like to use QueryDSL with Play! Everything looks very good in Play except those inline parts of JPQL as strings. It reminds me of CakePHP...
I'd like to have refactoring-proof querying language in Play (and some other things :) ).
QueryDSL usage would be straightforward. It needs EntityManager only. But QueryDSL has this APT class generator (just like the one from Hibernate for citeria API).
Does anyone managed to get this class generator work with Play? Is it possible to recreate and hot reload those classes?
I think the experience of Project Lombok with annotation processing in the Play framework will be helpful to you. It is easy to setup APT processing, but very specific. Look at the play-lombok module. Don't ignore the commands.py file and change the org.eclipse.jdt.core-3.6.0.jar reference to match the version used in your version of Play.
I use Querydsl in the Play framework for all my recent projects. I do not use JPA, however. I use my own object models with Querydsl instead of ORM to get a good fit depending on the situation. I haven't had a need for APT with Querydsl.
I have not created any tight integration between Play and Querydsl, but I just use a bit of boilerplate in each controller method. Some day I'll write a proper plugin.
I'm running play with querydsl using eclipse. (see http://blog.mysema.com/2010/10/using-querydsl-in-eclipse.html)
As generated source dir i used app/ which means that the Q classes will be generated in the same dir as the model classes which is not optimal but works.
Added these lines to the dependencies.yml
- com.mysema.querydsl -> querydsl-jpa 2.2.3
- com.mysema.querydsl -> querydsl-apt 2.2.3
- log4j -> log4j 1.2.16
- javassist -> javassist 3.12.1.GA
repositories:
- queryDSL:
type: iBiblio
root: "http://source.mysema.com/maven2/releases/"
contains:
- com.mysema -> *
Then use play dependencies --sync and play eclipsify and reopen the project in eclipse and it should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With