Fresh back from JUDCon 2011:London, I quickly want to blog about my Hibernate OGM presentation. For the impatient, all the code and the presentation itself is available on GitHub - ogm-kitchensink. The README.md gets you started with building, testing and deploying the code. Deployment is possible into a local JBoss AS 7 instance as well as into OpenShift Express.
The demo is based on the AS 7 quickstart application kitchensink and shows a registration screen with name, email and phone number. Even though this is a very simple application there are several interesting things going on under the hood, most importantly the use of OGM :-)
The demo uses OGM in the version 3.0.0.Alpha2 which requires Hibernate Core 3.6. However, AS 7 ships with Hibernate 4. The solution to this problem is to define a Hibernate 3 module as described by Scott in
mvn groovy:executeThis will copy all required module jars and configuration files into the appropriate location of your local AS 7 instance.
Provided you have installed the modules and started JBoss AS, you can run the demo locally as simple as:
mvn clean package jboss-as:deploy
$ mvn testor
$ mvn test -DremoteTests=trueCheck the profile setup in pom.xml to see the difference in the configuration.
Last but not least, let's push the demo into OpenShift Express. This is as simple as signing up for OpenShift, installing the rhc command line tools and then running:
$ rhc-create-domain -n <domain> $ rhc-create-app -a <app> -t jbossas-7.0 --nogit ... Success! Your application is now published here: http://<name>-<domain>.rhcloud.com/ The remote repository is located here: <repo-url> ... $ git remote add openshift <repo-url> $ git push -f openshift masterThe interesting bit here is to get the required modules installed on the server side. It turns out, all you have to do is to check add them to the git repository under .openshift/modules.
Looking forward to some feedback,