Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Light weight alternative to Hibernate? [closed]

Hibernate requires next to zero configuration if you use annotations. It even can auto-discover mapped beans in the classpath! I don't see any alternative to it from both simplicity and power point of view.

It can also expose itself as JPA, which is (IMHO) even simpler.


My ORMLite library is one such alternative. It supports MySQL, Postgres, Microsoft SQL Server, H2, Derby, HSQLDB, and Sqlite, and can be easily extended to others. It uses annotations to configure classes, good Spring support, flexible query builder, etc..


It still requires XML configuration, but have a look at MyBatis (formerly iBatis).


jOOQ ships with a fluent DSL simulating SQL directly in Java as a side-effect for its main goals which are:

  • Source code generation
  • Full support for standard SQL including SQL language features such as UNIONs, nested SELECTs, all types of JOINs, aliasing (e.g. for self-joins), etc
  • Wide support for non-standard SQL including UDT's, stored procedures, vendor-specific functions, etc.

Read about jOOQ in this article: http://java.dzone.com/announcements/simple-and-intuitive-approach, or visit the website directly: http://www.jooq.org

(Disclaimer, I work for the company behind jOOQ)


Apache Commons DBUtils takes much of the repetitive gruntwork out of JDBC programming. It requires little configuration and is easy to learn. It is not an ORM framework (in the way that Hibernate and other frameworks mentioned here are) but it does automate mapping of SELECT columns to Java member fields as well as other repetitive JDBC programming tasks. It's certainly lightweight.