I'm using the SchemaExportTask ANT task in Hibernate 3.1.3 to export a schema for MySQL and Oracle.
The MySQL create DDL generated maps hibernate calendar types (or java.util.Calendar) to DATETIME SQL fields
Code:
CREATEDDATE datetime not null
whereas the Oracle create DDL maps the same types to TIMESTAMP SQL fields
Code:
CREATEDDATE timestamp not null
I want MySQL to use timestamp as well. This mapping appears to be defined in the org.hibernate.dialect.MySQLDialect and org.hibernate.dialect.Oracle9Dialect classes, which contain
Code:
registerColumnType( Types.TIMESTAMP, "datetime" );
and
Code:
registerColumnType( Types.TIMESTAMP, "timestamp" );
respectively.
Is there a way of overriding these default mapping types, so that MySQL will use a SQL TIMESTAMP for hibernate calendar types, and probably SQL DATETIME for hibernate timestamp types (or java.util.Date)?