Defining custom entity classes
You can easily use a custom instance class for an entity.
All you have to do is to specify its full qualified name in the 'class' attribute of the target entity in the configuration file. The class can be a POJO (Plain Old Java Object).
You can then decide to declare some of the getters or setters, or one of the insert(), update() or delete() methods if you want to specialize them, for instance to include some specific validation code.
It is also allowed to have your class inherit from
If you are not using the velocity-tools project, you can easily populate a Velocity context with a code as simple as this one:
Some remarks, thought:
Alternatively, you can handle yourself the initialization process:
You can build the javadoc using the 'javadoc' ant target.
Using Velosurf from within Java
Velosurf can be used from Java as easily as from VTL.
It can be more convenient than using the jdbc classes and methods, especially if you want to re-use from Java the attributes you have defined in velosurf.xml.
Please note that to avoid sql connection timeouts, you should not declare Velosurf prepared statements as variables having a long lifecycle (like static members). You should only keep references to Velosurf connection objets on the long term (they do handle timeouts).