-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Issue with SchemaExport: Datetime in DB2
PostPosted: Tue May 31, 2005 4:05 pm 
Newbie

Joined: Fri Apr 08, 2005 2:22 pm
Posts: 8
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 4:40 pm 
Regular
Regular

Joined: Tue May 24, 2005 10:19 am
Posts: 65
you can try:
1)create your dialects.
2)create you usertype.
see docs.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 9:17 am 
Newbie

Joined: Fri Apr 08, 2005 2:22 pm
Posts: 8
zesj wrote:
you can try:
1)create your dialects.
2)create you usertype.
see docs.


I'm not entirely certain what you are suggesting. I am using DB2Dialect, which has been working well for me up until now, so I don't understand why I would need to create my own Dialect.

After doing a bit of research I am not understanding what defining another user UserType will buy me. Maybe I'm slow, but I don't understand.

ANy chance you or someone else could elaborate?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 3:50 pm 
Newbie

Joined: Fri Apr 08, 2005 2:22 pm
Posts: 8
I'm still waiting for either a "yes, that is possible and here is how you do it" or "no, sorry, you are going to need multiple mapping documents"

Any ideas?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.