QueryDSL和Play框架 [英] QueryDSL and Play Framework

查看:104
本文介绍了QueryDSL和Play框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我在QueryDSL和JPA2上使用了一段时间,这是我所知道的ORM的最强大组合. JPA Criteria API是一场灾难.借助QueryDSL,我也忘记了JPQL.

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.

我想在Play上使用QueryDSL!除了JPQL的内联部分作为字符串外,其他所有内容在Play上看起来都很好.它使我想起CakePHP ...

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

我想在Play中使用可重构的查询语言(以及其他一些东西:)).

I'd like to have refactoring-proof querying language in Play (and some other things :) ).

QueryDSL的用法很简单.它仅需要EntityManager. 但是QueryDSL拥有此APT类生成器(就像Hibernate的citeria API一样).

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

有人设法使此类生成器与Play一起使用吗?是否可以重新创建并热重载这些类?

Does anyone managed to get this class generator work with Play? Is it possible to recreate and hot reload those classes?

推荐答案

我认为 Project龙目岛的nofollow>经验会对您有所帮助.设置APT处理很容易,但是非常具体.查看 play-lombok模块.不要忽略commands.py文件,并更改org.eclipse.jdt.core-3.6.0.jar引用以匹配您的Play版本中使用的版本.

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.

我在所有最近的项目中都在Play框架中使用Querydsl.但是,我不使用JPA.我将自己的对象模型与Querydsl而不是ORM结合使用,以根据情况得到很好的拟合.我不需要Querydsl的APT.

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.

我还没有在Play和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.

这篇关于QueryDSL和Play框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆