Spring + Hibernate + Google AppEngine's Cloud SQL = Awesome!

DZone 's Guide to

Spring + Hibernate + Google AppEngine's Cloud SQL = Awesome!

· Cloud Zone ·
Free Resource
Java developers like Keith Mukai are doing some pretty awesome things with Google's preview of Cloud SQL for Google AppEngine.  Keith created a proof-of-concept app using Spring and Hibernate that was approved by Google to be part of the Cloud SQL limited preview which began last month.

Keith decided to use Hibernate because of his familiarity with using its annotations for his ORM layer.  After being out of the Hibernate world for so long, it felt like being in 2003 again, because he had to use Hibernate Tools and reveng.xml to generate the Hibernate *.hbm.xml mapping files.  He had to do this because annotations wouldn't work in AppEngine due to their limitations which don't support the JPA 2.0 spec.  Maybe there's a way around this, but Keith couldn't find it, so it was a little bit tedious.  However, the end result was worth it:

Once the basics were working I retrofitted my Java generics-based approach to the DAO layer that I had built for the App Engine datastore with Objectify. It gets a little complicated, but basically there's only ONE class that's actually implementing all the standard DAO CRUD. Java generics do the rest to apply that code to each domain entity. It's pretty damn cool.  -- Keith Mukai

Keith also decided that Hibernate would work better through Spring for his app, so maybe the frequent Spring users out there can find some interesting code in Keith's app.

Download the project code here. And let Keith know if there are any issues with the code.  He doesn't claim to be a Java expert.

The approach he used is discussed in more detail here:

The question now is, have all the recent changes to Google's AppEngine offerings alienated developers?  And is Cloud SQL a lucretive addition that will continue to bring in developer interest?

Source: http://blog.essaytagger.com/2011/11/spring-hibernate-on-google-app-engines.html


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}