GRAILS.IO Avatar

Posts tagged data

New version of GORM-JPA plugin available

I’ve just released a new version of the GORM-JPA plugin. Documentation is available here. This plugin differs from the older implementation in that it is based on the new Grails Data abstraction that I mentioned recently.

The plugin also includes an interesting use of Groovy AST transformations. There is an @JpaEntity transformation that transforms regular GORM syntax into a JPA entity at the byte code level. This is convenient for folks who prefer the GORM syntax but wish to map GORM entities to JPA. It even reads the mapping block form the ORM DSL and honors custom table / column name mappings etc.

The new version is also a full GORM implementation (not a partial implementation like the previous one) and even supports advanced features like the new Grails 2.0 where queries.

Like the previous plugin you either have to install the Hibernate JPA provider plugin or configure your own “entityManagerFactory” bean to use the plugin.

Custom Implementations of GORM

I just thought I would highlight once again what we are doing with Grails on the data layer. The Grails Data Mapping project is essentially where all new data work is happening with Grails.

It is divided into two parts:

  • A core API for developers to implement to provide CRUD and querying onto any datastore imaginable 
  • A GORM layer that operates on top of this core API and provides the meta-programming and AST transformation logic for you

Developers only have to implement step part one and part two comes for free. This is a big benefit, because previously custom implementations of GORM included their own meta-programming and/or AST transformation layer. This is no longer necessary.

Checkout the developer guide that I put together which shows how you can implement GORM on top of any datastore you fancy (including your own REST API).