简体   繁体   中英

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

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

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:

http://www.mybatis.org/

Hibernate provides very nice ActiveRecord-like access. 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). 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM