play-ebean
play-ebean module adds Ebean (http://www.avaje.org) ORM to Play! Framework as an alternative to Hibernate. Currently we use this module in two applications of my company, but I don’t know if other has tested it. Since Ebean uses JPA annotations as Hibernate no change in model shuould be done in general.
Getting started
- Install the ebean module
- add ‘module.ebean=${play.path}/modules/ebean’ in application.conf file
- Optionally create a file named “ebean.properties” in your application’s conf directory. This is optional but if this file does not exist ebean will issue a warning messsage. See example applications and ebean documentation about usage of this file
Usage
I’d tried to mimic the way standard JPAPlugin does the things. There’s aEbeanSupport class which is enhanced with helper methods with names and parameters as in JPASupport where possible. There’s also Model class which adds id field for all of its descendants. Also JPASupport implements play.db.Model interface which gives the possibility to use CRUD module as well as Fixtures.
However there are differences in usage of EbeanPlugin compared to standard JPAPlugin, the biggest being is that Ebean does not support JPA query. Here is what ebean documentation says:
Ebean has it’s own query language. Prior to this decision JPQL (the JPA query language)
was investigated to see if it would meet the desired goals of Ebean and it did not.
Specifically I wanted to support “Partial Objects” via the query language and it is difficult
to see how JPQL will evolve to support this (specifically difficulties around its select clause).