I didn't notice if you got an answer to this yet - so just ignore me if otherwise ;)
You are correct about your need to extend configuration/dialect.
You probably also need to look at Table.primaryKey and see where it is used when creating primary keys.
I also *think* HSQLDialect has the same issues and that it is not handled in a good way at the moment (some instanceof HSQLDialect somewhere).
Thus you should add something like "requireAlterTableForPrimaryKey()" or something to
Dialect to handle it more smoothly.
/max
All,
I am in the process of creating a dialect to communicate with Gupta SQLbase database. Currently I am facing a problem of "Table in incomplete state". According to Gupta this problem is caused by a missing index on the primary key. This appears to be correct since there are no indexes created on my table (NOTATION), once the SchemaExport runs. I have tested the same mapping documents and identical code on MSSQL Server, using the provided dialect (SQLServerDialect) and there are no problems with index creation. This is due to the fact that indexes on primary key are created implicitly under such DBs as Oracle and MSSQL Server. Unfortunately this is not the case with Gupta SQL Base, where the index must be created explicitly. Hence my question:
Since this problem is DB specific, any ideas on how to incorporate functionality to force explicit index creation on PK, after table generation?
As I understand it I am faced with extending:
org.hibernate.cfg.Configuration org.hibernate.dialect.Dialect + my own dialect
I have less then a month of exposure with Hibernate so there are probably many misconceptions in the above. Please correct me if you see anything wrong.
Thanks,
Sergei
************************RELEVANT INFORMATION************** Hibernate version: Hibernate3
Full stack trace of any exception that occurs:
[java] 12:19:02,110 DEBUG SQL:290 - insert into NOTATION (NOTE, TYPE, OWNER_ID, CREATE_DATE) values (?, ?, ?, ?) [java] Hibernate: insert into NOTATION (NOTE, TYPE, OWNER_ID, CREATE_DATE) values (?, ?, ?, ?) [java] 12:19:02,110 DEBUG AbstractBatcher:341 - preparing statement [java] 12:19:02,157 DEBUG JDBCExceptionReporter:49 - SQL Exception [java] java.sql.SQLException: 01417 DLU TIC Table in incomplete state
[java] at jdbc.gupta.sqlbase.SqlbaseStatement.SQLException(SqlbaseStatement.java:8 26) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:147) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:92) [java] at jdbc.gupta.sqlbase.SqlbaseConnection.prepareStatement(SqlbaseConnection. java:195) [java] at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher. java:349) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :71) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :65) [java] at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher .java:125) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:1653) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:2006) [java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java: 42) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:232) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:137) [java] at org.hibernate.event.AbstractFlushingEventListener.performExecutions(Abst ractFlushingEventListener.java:255) [java] at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventL istener.java:26) [java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814) [java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:75 ) [java] at org.hibernate.auction.Main.createNotation(Main.java:127) [java] at org.hibernate.auction.Main.main(Main.java:425) [java] 12:19:02,173 WARN JDBCExceptionReporter:57 - SQL Error: 0, SQLState: null [java] 12:19:02,173 ERROR JDBCExceptionReporter:58 - 01417 DLU TIC Table in incomplete state [java] 12:19:02,188 DEBUG JDBCExceptionReporter:49 - could not insert: [org.hibernate.auction.Notation] [insert into NOTATION (NOTE, T YPE, OWNER_ID, CREATE_DATE) values (?, ?, ?, ?)] [java] java.sql.SQLException: 01417 DLU TIC Table in incomplete state [java] at jdbc.gupta.sqlbase.SqlbaseStatement.SQLException(SqlbaseStatement.java:8 26) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:147) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:92) [java] at jdbc.gupta.sqlbase.SqlbaseConnection.prepareStatement(SqlbaseConnection. java:195) [java] at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher. java:349) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :71) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :65) [java] at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher .java:125) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:1653) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:2006) [java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java: 42) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:232) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:137) [java] at org.hibernate.event.AbstractFlushingEventListener.performExecutions(Abst ractFlushingEventListener.java:255) [java] at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventL istener.java:26) [java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814) [java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:75 ) [java] at org.hibernate.auction.Main.createNotation(Main.java:127) [java] at org.hibernate.auction.Main.main(Main.java:425) [java] 12:19:02,282 WARN JDBCExceptionReporter:57 - SQL Error: 0, SQLState: null [java] 12:19:02,282 ERROR JDBCExceptionReporter:58 - 01417 DLU TIC Table in incomplete state [java] 12:19:02,282 ERROR AbstractFlushingEventListener:258 - Could not synchronize database state with session [java] org.hibernate.exception.GenericJDBCException: could not insert: [org.hibernate.auction.Notation] [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQ LStateConverter.java:82) [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java :70) [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper. java:43) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:1683) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:2006) [java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java: 42) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:232) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:137) [java] at org.hibernate.event.AbstractFlushingEventListener.performExecutions(Abst ractFlushingEventListener.java:255) [java] at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventL istener.java:26) [java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814) [java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:75 ) [java] at org.hibernate.auction.Main.createNotation(Main.java:127) [java] at org.hibernate.auction.Main.main(Main.java:425) [java] Caused by: java.sql.SQLException: 01417 DLU TIC Table in incomplete state [java] at jdbc.gupta.sqlbase.SqlbaseStatement.SQLException(SqlbaseStatement.java:8 26) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:147) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:92) [java] at jdbc.gupta.sqlbase.SqlbaseConnection.prepareStatement(SqlbaseConnection. java:195) [java] at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher. java:349) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :71) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :65) [java] at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher .java:125) [java] Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not insert: [org.hibernate.auction.Notation] [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQ LStateConverter.java:82) [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java :70) [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper. java:43) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:1683) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:2006) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:1653) [java] ... 10 more [java] 12:19:02,407 DEBUG JDBCTransaction:99 - rollback [java] 12:19:02,423 DEBUG SessionImpl:363 - transaction completion [java] 12:19:02,423 DEBUG SessionImpl:232 - closing session [java] 12:19:02,423 DEBUG SessionImpl:311 - disconnecting session [java] 12:19:02,423 DEBUG AbstractBatcher:392 - closing JDBC connection (open PreparedStatements: 1, globally: 1) (open ResultSets: 0, globally: 0) [java] 12:19:02,423 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1 [java] 12:19:02,423 DEBUG SessionImpl:363 - transaction completion [java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java: 42) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:232) [java] at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:137) [java] at org.hibernate.event.AbstractFlushingEventListener.performExecutions(Abst ractFlushingEventListener.java:255) [java] at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventL istener.java:26) [java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814) [java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:75 ) [java] at org.hibernate.auction.Main.createNotation(Main.java:127) [java] at org.hibernate.auction.Main.main(Main.java:425) [java] Caused by: java.sql.SQLException: 01417 DLU TIC Table in incomplete state [java] at jdbc.gupta.sqlbase.SqlbaseStatement.SQLException(SqlbaseStatement.java:8 26) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:147) [java] at jdbc.gupta.sqlbase.SqlbasePreparedStatement.<init>(SqlbasePreparedStatem ent.java:92) [java] at jdbc.gupta.sqlbase.SqlbaseConnection.prepareStatement(SqlbaseConnection. java:195) [java] at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher. java:349) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :71) [java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java :65) [java] at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher .java:125) [java] at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister .java:1653) [java] ... 10 more
BUILD FAILED C:\java\eclipse\workspace\HibernateSQLBase\build.xml:624: Java returned: 1
Name and version of the database you are using: Gupta SQL Base 7.6.0
The generated SQL (show_sql=true): [java] 12:19:01,751 DEBUG SchemaExport:154 - create table NOTATION ( [java] TYPE varchar(2) not null, [java] OWNER_ID varchar(40) not null, [java] CREATE_DATE date not null, [java] NOTE LONG VARCHAR, [java] primary key (TYPE, OWNER_ID, CREATE_DATE) [java] )
-- Max Rydahl Andersen callto://max.rydahl.andersen
Hibernate [EMAIL PROTECTED] http://hibernate.org
JBoss Inc [EMAIL PROTECTED] http://jboss.com
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel