1) Extract the daohome.ftl freemarker template from the hibernate-tools.jar (in the root dao package). Put it somewhere in your project (I would use templates/dao).
2) Modify the freemarker template as needed (see hint at the bottom of post)
3) Run the reverse engineering specifying the custom template location (in console, check "Use custom templates" and point to the templates folder).
4) Sit back and enjoy.
P.S. If you do not know/have time to learn Freemarker, just stick this in the template where you want the method to appear (untested):
Code:
public ${pojo.importType("java.util.List")}<${declarationName}> loadAll() {
log.debug("getting all ${declarationName} instances");
try {
${pojo.importType("java.util.List")}<${declarationName}> data = sessionFactory.getCurrentSession().createCriteria("${clazz.entityName}");
log.debug("getAll successful");
return data;
}
catch (RuntimeException re) {
log.error("getAll failed", re);
throw re;
}
}