You just need to inform hibernate tools during reverse engineering that when it sees a TIMESTAMP use the PersistentDateTime type; then when hbm2java runs it will consult PerstentDateTime (remember to have it in the classpath!) on which java type it should use (via the getReturnedClass() method)
so there is two options for this:
a) in a .reveng.xml file:
Code:
<type-mapping>
<sql-type jdbc-type="TIMESTAMP" hibernate-type="org.joda.time.contrib.hibernate.PersistentDateTime"/>
</type-mapping>
b) via custom reveng strategy where you implement something like:
Code:
public class CustomStrategy extends DelegatingReverseEngineeringStrategy {
public CustomStrategy(ReverseEngineeringStrategy res) {
super(res);
}
public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
if(sqlType==Types.TIMESTAMP) {
return "org.joda.time.contrib.hibernate.PersistentDateTime";
} else {
super.columnToHibernateTypeName(...);
}
}