this is a revised version of the dialect:
public class MSAccessDialect extends Dialect { public MSAccessDialect() { super(); register( Types.BIT, "BIT" ); register( Types.BIGINT, "INTEGER" ); register( Types.SMALLINT, "SMALLINT" ); register( Types.TINYINT, "BYTE" ); register( Types.INTEGER, "INTEGER" ); register( Types.CHAR, "VARCHAR(1)" ); register( Types.VARCHAR, "VARCHAR($l)" ); register( Types.FLOAT, "DOUBLE" ); register( Types.DOUBLE, "DOUBLE" ); register( Types.DATE, "DATETIME" ); register( Types.TIME, "DATETIME" ); register( Types.TIMESTAMP, "DATETIME" ); register( Types.VARBINARY, "VARBINARY($l)" ); register( Types.NUMERIC, "NUMERIC" );
getDefaultProperties().setProperty(Environment.OUTER_JOIN, "false");
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}
with access in defining the columns we should be careful on field names, like in this case changing string and single as shown makes the schema generation work:
<class name="cirrus.hibernate.test.Several"> <composite-id> <key-property name="id" length="32"/> <key-property name="stringX" length="32"/> </composite-id> <many-to-one name="singleX"> <column name="single_id" length="32"/> <column name="single_string" length="32"/> </many-to-one> </class>
actually generating schema for all tests still gives a few errors, but I believe all due to such field names problems.
So now concentrating on
cirrus.hibernate.test.FooBarTest
schema generation:
I had to change:
<property name="yesno" column="yesno_"/>
it didn't take a column named "yesno" for to me misterious reasons.
Then schema is generated fine.
Tests run: 59, Failures: 0, Errors: 48
The first error is in TestAssociationId; so I limited the test to the following code:
public void testAssociationId() throws Exception {
Session s = sessions.openSession(); Transaction t = s.beginTransaction(); Bar bar = new Bar(); String id = (String) s.save(bar); MoreStuff more = new MoreStuff(); more.setName("More Stuff"); more.setIntId(12); more.setStringId("id"); Stuff stuf = new Stuff(); stuf.setMoreStuff(more); more.setStuffs( new ArrayList() ); more.getStuffs().add(stuf); stuf.setFoo(bar); stuf.setId(1234); stuf.setProperty( TimeZone.getDefault() ); s.save(more); t.commit(); s.close(); }
which generates:
13:17:15,603 DEBUG DriverManagerConnectionProvider:97 - returning connection to pool
13:17:15,673 DEBUG SessionFactoryImpl:113 - Instantiating session factory
13:17:15,673 INFO Dialect:37 - Using dialect: cirrus.hibernate.sql.MSAccessDialect
13:17:15,683 INFO DriverManagerConnectionProvider:36 - Hibernate connection pool size: 2
13:17:15,683 INFO DriverManagerConnectionProvider:65 - Using driver: com.inzoom.jdbcado.Driver at URL: jdbc:izmado:IzmDllPath=E:\cvs_out\teamwork\html\WEB-INF\lib\IzmJniAdo.dll;IzmRoyaltyFree=XXXXXX;Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=e:\cvs_out\teamwork\data\teamwork_ol.mdb
13:17:15,683 INFO DriverManagerConnectionProvider:66 - Connection properties: {user=admin, password=}
13:17:15,693 INFO PreparedStatementCache:49 - prepared statement cache size: 100
13:17:15,693 INFO SessionFactoryImpl:144 - Use outer join fetching: false
13:17:15,703 DEBUG DriverManagerConnectionProvider:78 - Opening new JDBC connection
13:17:15,733 DEBUG DriverManagerConnectionProvider:89 - Created connection to: jdbc:izmado:IzmDllPath=E:\cvs_out\teamwork\html\WEB-INF\lib\IzmJniAdo.dll;IzmRoyaltyFree=XXXXXX;Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=e:\cvs_out\teamwork\data\teamwork_ol.mdb, Isolation Level: 2
13:17:15,753 DEBUG DriverManagerConnectionProvider:97 - returning connection to pool
13:17:15,763 INFO SessionFactoryImpl:167 - Use scrollable result sets: true
13:17:16,004 INFO DriverManagerConnectionProvider:120 - Cleaning up dereferenced connection pool: jdbc:izmado:IzmDllPath=E:\cvs_out\teamwork\html\WEB-INF\lib\IzmJniAdo.dll;IzmRoyaltyFree=XXXXXX;Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=e:\cvs_out\teamwork\data\teamwork_ol.mdb
13:17:18,017 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
13:17:18,037 DEBUG SessionFactoryObjectFactory:76 - registered: 40288086f22746bc00f22746d0c10000 (unnamed)
13:17:18,037 INFO SessionFactoryObjectFactory:82 - no JDNI name configured
13:17:18,037 INFO SessionFactoryImpl:261 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
13:17:18,037 INFO SessionFactoryImpl:264 - Query language imports: cirrus.hibernate.test
13:17:18,047 DEBUG SessionFactoryImpl:276 - Instantiated session factory
13:17:18,287 DEBUG SessionImpl:332 - opened session
13:17:18,287 DEBUG JDBCTransaction:34 - begin
13:17:18,297 DEBUG DriverManagerConnectionProvider:73 - Using cached JDBC connection
13:17:18,297 DEBUG SessionImpl:521 - saving [cirrus.hibernate.test.Bar#40288086:f22746bc:00f2:2746d1d9:0001]
13:17:18,307 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Bar
13:17:18,307 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,317 DEBUG SessionImpl:521 - saving [cirrus.hibernate.test.Fee#f22746d1ed0000]
13:17:18,317 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Fee
13:17:18,317 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Fee
13:17:18,327 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Fee
13:17:18,327 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Fee
13:17:18,327 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,327 DEBUG SessionImpl:521 - saving [cirrus.hibernate.test.Glarch#40288086f22746bc00f22746d1f70002]
13:17:18,327 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Glarch
13:17:18,327 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Glarch
13:17:18,327 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Glarch
13:17:18,337 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Glarch
13:17:18,337 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,347 DEBUG SessionImpl:521 - saving [cirrus.hibernate.test.Fee#f22746d20b0001]
13:17:18,347 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Fee
13:17:18,347 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Fee
13:17:18,347 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Fee
13:17:18,347 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Fee
13:17:18,347 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Bar
13:17:18,397 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Bar
13:17:18,407 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Bar
13:17:18,407 DEBUG SessionImpl:521 - saving [EMAIL PROTECTED]
13:17:18,407 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.MoreStuff
13:17:18,407 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.MoreStuff
13:17:18,417 DEBUG SessionImpl:2002 - Wrapped collection in role: MoreStuff/stuffs
13:17:18,417 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.MoreStuff
13:17:18,417 DEBUG Cascades:225 - cascading to collection: MoreStuff/stuffs
13:17:18,427 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,427 DEBUG SessionImpl:521 - saving [EMAIL PROTECTED]
13:17:18,427 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.MoreStuff
13:17:18,427 DEBUG JDBCTransaction:48 - commit
13:17:18,427 DEBUG SessionImpl:1605 - flushing session
13:17:18,437 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Bar
13:17:18,437 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,447 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,447 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,447 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Bar
13:17:18,447 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Glarch
13:17:18,447 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Glarch
13:17:18,457 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Fee
13:17:18,457 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Fee
13:17:18,457 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.Fee
13:17:18,457 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.Fee
13:17:18,457 DEBUG Cascades:250 - processing cascades for: cirrus.hibernate.test.MoreStuff
13:17:18,457 DEBUG Cascades:225 - cascading to collection: MoreStuff/stuffs
13:17:18,457 DEBUG Cascades:71 - cacading to saveOrUpdate()
13:17:18,457 DEBUG Cascades:257 - done processing cascades for: cirrus.hibernate.test.MoreStuff
13:17:18,467 DEBUG SessionImpl:1682 - Flushing entities and processing referenced collections
13:17:18,467 DEBUG SessionImpl:2036 - Collection found: [MoreStuff/[EMAIL PROTECTED], was: [<unreferenced>]
13:17:18,477 DEBUG DriverManagerConnectionProvider:78 - Opening new JDBC connection
13:17:18,557 DEBUG DriverManagerConnectionProvider:89 - Created connection to: jdbc:izmado:IzmDllPath=E:\cvs_out\teamwork\html\WEB-INF\lib\IzmJniAdo.dll;IzmRoyaltyFree=XXXXXX;Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=e:\cvs_out\teamwork\data\teamwork_ol.mdb, Isolation Level: 2
13:17:18,607 DEBUG DriverManagerConnectionProvider:97 - returning connection to pool
13:17:18,607 DEBUG HiLoGenerator:148 - New hi value: 0
13:17:18,607 DEBUG CollectionPersister:493 - Generated new collection ID 0 for role /foo_bytes
13:17:18,607 DEBUG SessionImpl:2036 - Collection found: [/foo_bytes#0], was: [<unreferenced>]
13:17:18,607 DEBUG SessionImpl:2036 - Collection found: [Foo/FooComponent/FooComponent/ImportantDates#40288086:f22746bc:00f2:2746d1d9:0001], was: [<unreferenced>]
13:17:18,627 DEBUG SessionImpl:2036 - Collection found: [Foo/FooComponent/importantDates#40288086:f22746bc:00f2:2746d1d9:0001], was: [<unreferenced>]
13:17:18,627 DEBUG SessionImpl:1874 - Processing unreferenced collections
13:17:18,627 DEBUG SessionImpl:1898 - Scheduling collection removes/(re)creates/updates
13:17:18,627 DEBUG SessionImpl:1617 - Flushed: 6 insertions, 0 updates, 0 deletions to 6 objects
13:17:18,637 DEBUG SessionImpl:1622 - Flushed: 4 (re)creations, 0 updates, 0 removals to 4 collections
13:17:18,637 DEBUG SessionImpl:1652 - Executing
13:17:18,637 DEBUG EntityPersister:464 - Inserting entity: cirrus.hibernate.test.Fee#f22746d1ed0000
13:17:18,637 DEBUG BatcherImpl:109 - 1 open PreparedStatements
13:17:18,637 DEBUG SessionFactoryImpl:469 - prepared statement get: insert into Fee ( fi, fee, anotherFee, qux, name, null_prop, id_ ) values ( ?, ?, ?, ?, ?, ?, ? )
13:17:18,647 DEBUG PreparedStatementCache:67 - Preparing statement: insert into Fee ( fi, fee, anotherFee, qux, name, null_prop, id_ ) values ( ?, ?, ?, ?, ?, ?, ? )
13:17:18,647 DEBUG EntityPersister:390 - Dehydrating entity: cirrus.hibernate.test.Fee#f22746d1ed0000
13:17:18,667 DEBUG JDBCExceptionReporter:33 - SQL Exception
com.inzoom.adojni.ComException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented in Microsoft OLE DB Provider for ODBC Drivers code=3105 Type=1
at com.inzoom.ado.Command.jniExecute(Native Method)
at com.inzoom.ado.Command.execute(Command.java:39)
at com.inzoom.ado.Command.executeUpdate(Command.java:51)
at com.inzoom.ado.Command.executeUpdate(Command.java:42)
at com.inzoom.jdbcado.PreparedStatement.executeUpdate(PreparedStatement.java:81)
at cirrus.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:20)
at cirrus.hibernate.persister.EntityPersister.insert(EntityPersister.java:478)
at cirrus.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:20)
at cirrus.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:1674)
at cirrus.hibernate.impl.SessionImpl.execute(SessionImpl.java:1654)
at cirrus.hibernate.impl.SessionImpl.flush(SessionImpl.java:1599)
at cirrus.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:51)
at cirrus.hibernate.test.FooBarTest.testAssociationId(FooBarTest.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.swingui.TestRunner$16.run(TestRunner.java:623)
13:17:18,677 WARN JDBCExceptionReporter:35 - SQL Error: 3105, SQLState:
13:17:18,677 ERROR JDBCExceptionReporter:42 - [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
13:17:18,687 DEBUG SessionImpl:366 - transaction completion
13:17:18,998 DEBUG SessionImpl:2428 - Running Session.finalize()
13:17:19,008 DEBUG SessionImpl:366 - transaction completion
13:17:19,008 WARN SessionImpl:2438 - Unclosed connection
suggestions to me, one of the many, will be welcome. You may be wondering why I am bothering on Access: well, no one will use for production, but on development on windows it's better then mysql as it raises exceptions on referential integrity violations (so you get no surprises in going in production, say on oracle), and also for the windows interface. regards
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel