This example uses Hibernate with Groovy using Groovy Grapes.
Which produces this output (logging not shown):
We can get a little more sophisticated and show a One-to-One relationship as follows:
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):