This is a spinoff question from this issue that I had answered recently:
http://forum.hibernate.org/viewtopic.php?t=943031
Here is the situation: I want to use SchemaExportTask to create a schema off of my mapping file for multiple database types. In an ideal situation, each of these schema would be created off of the same Mapping file, only using a different Dialect to talor things to a given database.
I am currently able to create DDL off of a single mapping file for MySQL, DB2, Oracle, and SQLServer.
However, when I try to run this DDL on a DB2 database, it dies anytime it sees a datetime, because that type does not exist in DB2. Therefore, when generating DDL for DB2, I would like to use timestamp. However, if I change the mapping document to replace datetime with timestamp, my mapping document will no longer work correctly when used to generate the DDL for MySQL.
A bunch of us were discussing this situation, and we all agreed that it was kind of weird that, when using the DB2Dialect, SchemaExportTask would knowingly create DDL that contains the type "datetime" without converting it to something that is valid in DB2.
So, is there any way to get around this issue without needing to create multiple mapping files?
If you need more information in order to troubleshoot my problem I would be more than happy to provide it. Please let me know.
Thanks for any help you can provide!
Mapping documents:
<property name="crmSyncEndDate" type="java.util.Date">
<column name="crm_sync_end_date" sql-type="
datetime" not-null="false" />
</property>
<property name="modifiedDate" type="java.util.Date" update="false" insert="false">
<column name="modified_date" sql-type="timestamp" not-null="false" />
</property>
Exception:
[schemaexport] 11056 [main] ERROR tool.hbm2ddl.SchemaExport - [IBM][CLI Driver]
[DB2/NT] SQL0204N "DATETIME" is an undefined name. SQLSTATE=42704