[英]Which Java database API is easiest to use?
I am coming back to Java from Ruby and ActiveRecord and want to use something as easy as ActiveRecord in Ruby. 我从Ruby和ActiveRecord回到Java,想在Ruby中使用像ActiveRecord一样简单的东西。 What options do I have?
我有什么选择?
有一个同事最近发布了一个名为ActiveJDBC的项目,它是ActiveRecord for Java的一个实现。
It'll probably some sort of Object Relational Mapping framework you end up using. 它可能是你最终使用的某种对象关系映射框架。 Grails (a Java Rails like framework) has GORM:
Grails(像框架这样的Java Rails)有GORM:
http://www.grails.org/GORM http://www.grails.org/GORM
If you're not using a web framework like that then it'll prob. 如果你没有使用像这样的网络框架那么它将是可能的。 be some sort of ORM framework - Hibernate, OpenJPA etc...
是某种ORM框架 - Hibernate,OpenJPA等......
http://www.hibernate.org/ http://www.hibernate.org/
If you don't want to do the full heavyweight ORM way then look at something like MyBatis (used to be iBatis) which has SQLMaps: 如果你不想做完整的重量级ORM方式,那么看看像MyBatis(曾经是iBatis)这样的东西有SQLMaps:
Hibernate provides very nice ActiveRecord-like access. Hibernate提供了非常好的类似ActiveRecord的访问。 There are tools to reverse-engineer models from the database.
有一些工具可以从数据库中反向设计模型。 I keep it simple and it works well for me.
我保持简单,对我来说效果很好。
I like JPA myself (Java Persistence API). 我自己喜欢JPA(Java Persistence API)。 Easy to configure and with the right tools you can generate the database from classes or generate the classes from the database.
易于配置,使用正确的工具,您可以从类生成数据库或从数据库生成类。 It's easy to configure your classes with the annotations that you can use.
使用您可以使用的注释配置类很容易。
I use the OpenJPA implementation myself. 我自己使用OpenJPA实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.