Java Orm框架
有人知道是否存在一个java框架,我不必实现DAO,但我只需要定义接口并且它像groovy实体一样工作?
例如,命名一个方法 findByPrimaryKey 它将自动检测主键并执行正确的操作。
我不确定,但我记得我在 Spring 中见过类似的东西......我错了吗?
Do someone know if there exists a framework for java where I don't have to implement the DAO but I need just to define the interface and it works like the groovy entities?
For example naming a method findByPrimaryKey it will autodetect the primary key and do the right thing.
I'm not sure but I remember I have seen something like this with Spring...Am I wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可能想看一下 Spring Data-JPA 项目。它具有与您需要的类似的功能。请参阅此处的页面。
这是一个链接 他们的查询方法。它认为这就是您正在寻找的东西。
You may want to take a look at the Spring Data-JPA project . It has similar features to what you need . See their page here.
Here's a link to their query methods . It think this is what you're looking for .
Spring有两个,都是基于JPA
There are two for Spring, both based on JPA
sormula 可能也适合您。 CRUD 操作无需任何 DAO 实现即可使用。它没有自动主键检测功能,但一个简单的注释定义了主键。
sormula may work for you also. CRUD operations are available without requiring any DAO implementions. It does not have auto primary key detection but one simple annotation defines the primary key(s).
从 Grails 2.3.6 开始,GORM 作为独立模块得到正式支持。有关更多详细信息,请参阅发行说明。
As of Grails 2.3.6, GORM is officially supported as a standalone module. See the release notes for more details.
您可能需要考虑 ActiveJDBC:http://javalite.io/activejdbc。它是根据 RoR ActiveRecord 建模的,并保留了它的一些动态行为。但是,在 Java 中,您无法在运行时定义新方法,因为 Ruby 中没有与
method_mising
等效的方法。您可以遵循大量文档:http://javalite.io/documentationyou might want to consider ActiveJDBC: http://javalite.io/activejdbc. It was modeled after RoR ActiveRecord, and retains some of its dynamic behavior. However, in Java you cannot define new methods at run time, as there is no equivalent of
method_mising
from Ruby. There is plenty documentation you can follow: http://javalite.io/documentation