Templating for hibernate