From: Phillip B. <phi...@cl...> - 2002-02-12 10:07:03
|
Had some spare time at work today and tried to create a dialect for the Progress database (from www.progress.com). While doing so I struck various obstacles which I'm hoping someone might be able to suggest some solutions. Problem #1: Progress requires you to either always prefix table names with a schema, or, alternatively use SET SCHEMA 'xxx' to set a default schema for your session. To work around this I started by changing the mappings used in the cirrus.hibernate.test package by adding a schema prefix to the various table names. This of course only worked where there was an explicit table mapping. So additional table mappings were required. Cool this got rid of a bunch of errors. The next thing to break was the table name used for unique ids, "hibernate_unique_key". This string is hardcoded into RelationalDataStore and HiLoGenerator and needed the schema prefix. My feeling is this table name should be part of the mapping rather than hardcoded. Another idea was to make the table name an attribute of Dialect. RelationDataStore looks reasaonbly easy to modify but I'm not so sure about HiLoGenerator. Any comments? The last obstacle with the schema prefix was Collection.createIndex() forms index names by added IDX to the table name. With a schema prepended to the table name this resulted in index names which caused SQL syntax errors. My quick fix for this was to get the createIndex method to stip off the schema prefix when it created the index name. I'm open to ideas for a better solution. Problem #2: testFind is throwing an exception during RelationalDatabaseSession.flush(). Haven't been able to figure this one out yet so will willingly accept any advice as to what may be the cause. Below is the output trace when debug is set to 4. testFind... Flushing: cirrus.hibernate.test.Foo 0a01003c:ebf8db1b:00eb:f8dbd778:0008 LOADED cirrus.hibernate.test.Foo: custom changed Generated new collection ID 65544 for table pub.foobytes [snipped repeated lines for 3 other objects] Flushing 4 insertions, 4 updates, 0 deletions to 4 objects and updating 12 collections.... cirrus.hibernate.collections.ArrayHolder@4980c9:null-->cirrus.hibernate.impl.CollectionPersister@32e13d [snipped 10 similar lines] cirrus.hibernate.collections.ArrayHolder@b76fa:null-->cirrus.hibernate.impl.CollectionPersister@32e13d [1] insert into pub.foos ( bar_string, bar_count, name, importantDates, the_time, foo, long_, integer_, float_, double_, bytes, date_, timestamp_, boolean_, bool_, null_, short_, zero_, int_, string_, byte_, yesno, blobb_, nullBlob, status_, bin_, first_name, surname, count_, name_, subcount, subname, foo_id, class ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'cirrus.hibernate.test.Bar' ) [2] insert into pub.foos ( foo, long_, integer_, float_, double_, bytes, date_, timestamp_, boolean_, bool_, null_, short_, zero_, int_, string_, byte_, yesno, blobb_, nullBlob, status_, bin_, first_name, surname, count_, name_, subcount, subname, foo_id, class ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'cirrus.hibernate.test.Foo' ) [3] insert into pub.foos ( foo, long_, integer_, float_, double_, bytes, date_, timestamp_, boolean_, bool_, null_, short_, zero_, int_, string_, byte_, yesno, blobb_, nullBlob, status_, bin_, first_name, surname, count_, name_, subcount, subname, foo_id, class ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'cirrus.hibernate.test.Foo' ) [4] insert into pub.foos ( bar_string, bar_count, name, importantDates, the_time, foo, long_, integer_, float_, double_, bytes, date_, timestamp_, boolean_, bool_, null_, short_, zero_, int_, string_, byte_, yesno, blobb_, nullBlob, status_, bin_, first_name, surname, count_, name_, subcount, subname, foo_id, class ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'cirrus.hibernate.test.Bar' ) [5] update pub.foos set foo = ?, long_ = ?, integer_ = ?, float_ = ?, double_ = ?, bytes = ?, date_ = ?, timestamp_ = ?, boolean_ = ?, bool_ = ?, null_ = ?, short_ = ?, zero_ = ?, int_ = ?, string_ = ?, byte_ = ?, yesno = ?, blobb_ = ?, nullBlob = ?, status_ = ?, bin_ = ?, first_name = ?, surname = ?, count_ = ?, name_ = ?, subcount = ?, subname = ? where foo_id = ? [6] update pub.foos set foo = ?, long_ = ?, integer_ = ?, float_ = ?, double_ = ?, bytes = ?, date_ = ?, timestamp_ = ?, boolean_ = ?, bool_ = ?, null_ = ?, short_ = ?, zero_ = ?, int_ = ?, string_ = ?, byte_ = ?, yesno = ?, blobb_ = ?, nullBlob = ?, status_ = ?, bin_ = ?, first_name = ?, surname = ?, count_ = ?, name_ = ?, subcount = ?, subname = ? where foo_id = ? [7] update pub.foos set bar_string = ?, bar_count = ?, name = ?, importantDates = ?, the_time = ?, foo = ?, long_ = ?, integer_ = ?, float_ = ?, double_ = ?, bytes = ?, date_ = ?, timestamp_ = ?, boolean_ = ?, bool_ = ?, null_ = ?, short_ = ?, zero_ = ?, int_ = ?, string_ = ?, byte_ = ?, yesno = ?, blobb_ = ?, nullBlob = ?, status_ = ?, bin_ = ?, first_name = ?, surname = ?, count_ = ?, name_ = ?, subcount = ?, subname = ? where foo_id = ? java.lang.reflect.InvocationTargetException: java.sql.SQLException: [JDBC Progress Driver]:Data type for parameter 1 has changed since first SQLExecute call. at com.progress.sql.jdbc.JdbcProgress.createSQLException(JdbcProgress.java:6501) at com.progress.sql.jdbc.JdbcProgress.standardError(JdbcProgress.java:6675) at com.progress.sql.jdbc.JdbcProgress.SQLExecute(JdbcProgress.java:2789) at com.progress.sql.jdbc.JdbcProgressPreparedStatement.execute(JdbcProgressPreparedStatement.java:238) at com.progress.sql.jdbc.JdbcProgressPreparedStatement.executeUpdate(JdbcProgressPreparedStatement.java:144) at cirrus.hibernate.impl.ClassPersister.update(ClassPersister.java:574) at cirrus.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:25) at cirrus.hibernate.impl.RelationalDatabaseSession.executeAll(RelationalDatabaseSession.java:894) at cirrus.hibernate.impl.RelationalDatabaseSession.flush(RelationalDatabaseSession.java:880) at cirrus.hibernate.impl.RelationalDatabaseSession.find(RelationalDatabaseSession.java:400) at cirrus.hibernate.impl.RelationalDatabaseSession.find(RelationalDatabaseSession.java:331) at cirrus.hibernate.test.FooBarTest.testFind(FooBarTest.java:118) at java.lang.reflect.Method.invoke(Native Method) at cirrus.hibernate.test.TestCase.run(TestCase.java:46) at cirrus.hibernate.test.FooBarTest.main(FooBarTest.java:648) Exception in thread "main" [8] update pub.foos set bar_string = ?, bar_count = ?, name = ?, importantDates = ?, the_time = ?, foo = ?, long_ = ?, integer_ = ?, float_ = ?, double_ = ?, bytes = ?, date_ = ?, timestamp_ = ?, boolean_ = ?, bool_ = ?, null_ = ?, short_ = ?, zero_ = ?, int_ = ?, string_ = ?, byte_ = ?, yesno = ?, blobb_ = ?, nullBlob = ?, status_ = ?, bin_ = ?, first_name = ?, surname = ?, count_ = ?, name_ = ?, subcount = ?, subname = ? where foo_id = ? Regards, Phillip B. |