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 :-)
AS 7 modules
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
Using a different persistence provider with AS 7.0.1 . The demo does exactly that. In fact it actually bundles all the steps described in the blog and let you create the required modules via a single maven command. Just check out ogm-kitchensink, make sure your JBOSS_HOME variable is set properly and run:
mvn groovy:executeThis will copy all required module jars and configuration files into the appropriate location of your local AS 7 instance.
Running the demo locally
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
Of course the demo comes with a test. Check out MemberRegistrationTest to see how to put together a Arquillian test and then run the test either via:
$ 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.
Again, check out README.md, script.md and the presentation slides for more information.
Looking forward to some feedback,