Description

You have the ability to define your own templates using the Velocity language to access the object model represending the Hibernate mapping data put into the context. Using this functionality, Java classes or resource files can be created to quickly and easily create a large amount of code that is error free once your have verified your templates. The actual templates are defined globally (preferences page) but the generation output locations are defined in the individual projects. When the standard synchronization occurs, the custom template generation will be executed as well.

Context Variables

By default, there are several parameters that can be accessed in the context:

You also have the ability to define your own context object in the project properties. To reference this object, use the ${obj} variable in your template.

Multiple Class Generation

Since the standard generation deals with a single class, you may have the need to perform a generation that relates to all of your class definitions which may or may not be in multiple files. To start a generation like this, select any of the Hibernate mapping files that you would like to be included then right click and select Hibernate >> Template Generation.
You will receive all of the context objects mentioned previously but 1 more will exist: