Thomas Fischer wrote:
Just tried the patch and I had problems writing a timestamp to a Oracle 9i Database. I did the following: - apply the patch to db.props from the torque-3.1-release (by the way: the patch is reversed, i.e. I had to apply the -R option for patching)
Yes, that is right.
- create an object with a timestamp value (snippet from project-schema.xml) <table name="author" description="Author Table"> <column name="author_id" required="true" primaryKey="true" type="INTEGER" description="Author Id"/> <column name="last_name" required="false" type="VARCHAR" size="128" description="Last Name"/> <column name="last_write_date" required="false" type="TIMESTAMP" description="Last write timestamp"/> </table>
- run the following code
public void testLastWriteDate() { try { Author author = new Author(); author.setLastWriteDate(someDateObject_see_below); author.save(); } catch (Exception e) { fail(e.getClass().getName() + " : " + e.getMessage()); } }
- The following errors occur: If I use
author.setLastWriteDate(new Timestamp(System.currentTimeMillis())); or author.setLastWriteDate(new java.sql.Date(System.currentTimeMillis()));
I get the following exception: ORA-01843: Kein g�ltiger Monat (in english: "no valid month")
If I use
author.setLastWriteDate(new java.util.Date());
I get: ORA-01858: ein nicht-numerisches Zeichen wurde gefunden, wo numerisches erwartet wurde (in english: a non-numeric character was found where a numeric character was expected)
If I use the original db.props from the 3.1 release, the above test case does not give an error, although the precision of the date is limited to full seconds.
So it seems that, in addition to patching db.props, additional changes are necessary to get a timestamp with better precision than seconds. However, as db.props no longer appears in the CVS HEAD branch, I am not sure whether it is worth while to pursue this issue for the 3.1.1 release.
In CVS HEAD the change would be:
Index: PlatformOracleImpl.java
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformOracleImpl.java,v
retrieving revision 1.6
diff -u -r1.6 PlatformOracleImpl.java
--- PlatformOracleImpl.java 22 Feb 2004 06:27:19 -0000 1.6
+++ PlatformOracleImpl.java 17 Aug 2004 02:38:12 -0000
@@ -53,8 +53,8 @@
setSchemaDomainMapping(new Domain(SchemaType.NUMERIC, "NUMBER"));
setSchemaDomainMapping(new Domain(SchemaType.VARCHAR, "VARCHAR2"));
setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR, "VARCHAR2", "2000"));
- setSchemaDomainMapping(new Domain(SchemaType.TIME, "DATE"));
- setSchemaDomainMapping(new Domain(SchemaType.TIMESTAMP, "DATE"));
+ setSchemaDomainMapping(new Domain(SchemaType.TIME, "TIME"));
+ setSchemaDomainMapping(new Domain(SchemaType.TIMESTAMP, "TIMESTAMP"));
setSchemaDomainMapping(new Domain(SchemaType.BINARY, "LONG RAW"));
setSchemaDomainMapping(new Domain(SchemaType.VARBINARY, "BLOB"));
setSchemaDomainMapping(new Domain(SchemaType.LONGVARBINARY, "LONG RAW"));
By the way, the errors occur with Sarav's village jar (version 20040806) as well as with the original village.jar.
Thomas
After seeing your testing I don't think I will apply this for 3.1.1.
As for 3.2-dev (HEAD) it will be up to someone else to determine the full set of changes required to make this work for Oracle - volunteers welcome.
Thanks,
Scott
-- Scott Eade Backstage Technologies Pty. Ltd. http://www.backstagetech.com.au
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
