This example uses Hibernate with Groovy using Groovy Grapes.
Which produces this output (logging not shown):
Found 2 books: Groovy in Action by Dierk et al Spring in Action by Craig
We can get a little more sophisticated and show a One-to-One relationship as follows:
Where the configureHibernate method needs an additional line:
And creation would become:
We can get even fancier with a one-to-many association (one way to do it):
With creation code like this:
Which has output like this (logging not shown):
Found 2 books: Groovy in Action by Paul, Jon, Guillaume, Dierk, Andy Spring in Action by Craig
Labels
2 Comments
Hide/Show CommentsFeb 07, 2009
Chanwit Kaewkasi
Hi Paul,
Great tutorial indeed
This makes me really want to try Grape.
Few things here, do we need public modifiers around? Or you just put them there to make the code more familiar to Java's guys
Apr 08, 2009
Jeremy Leipzig
if you are behind a proxy you will need to tell Groovy so Grape can fetch your dependencies
groovy -Dhttp.proxyHost=yourproxy -Dhttp.proxyPort=8080 yourscript.groovy
http://groovy.codehaus.org/Grape#Grape-Proxysettings