Hi !
The informix dialect maps an ID field with generator class native, increment, identity o sequence to serial8 or int8 Informix DataTypes, but this are only for Informix 9 and i need use it in Informix 7 and even 5
Check at the column EVENT_ID of the Mapping documents and the SQL generated...
The correct DataType should be serial or int (not serial8 or int8)
Please some help! Thanks
Hibernate version: 3.0
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="native" />
</id>
<property name="date" type="timestamp" column="EVENT_DATE" />
<property name="title" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
Event theEvent = new Event();
theEvent.setTitle(title);
theEvent.setDate(theDate);
session.save(theEvent);
tx.commit();
HibernateUtil.closeSession();
Full stack trace of any exception that occurs:
[java] 14:06:10,515 DEBUG SchemaExport:143 - drop table EVENTS
[java] 14:06:10,562 DEBUG SchemaExport:149 - Unsuccessful: drop table EVENTS
[java] 14:06:10,562 DEBUG SchemaExport:150 - The specified table (events) is not in the database.
[java] 14:06:10,562 DEBUG SchemaExport:161 - create table EVENTS (
[java] EVENT_ID serial8 not null,
[java] EVENT_DATE datetime year to fraction(5),
[java] title varchar(255),
[java] primary key (EVENT_ID)
[java] )
[java] 14:06:10,578 ERROR SchemaExport:167 - Unsuccessful: create table EVENTS (EVENT_ID serial8 not null, EVENT_DATE datetime year to fraction(5), title varchar(255), primary key (EVENT_ID))
[java] 14:06:10,578 ERROR SchemaExport:168 - A syntax error has occurred.
[java] 14:06:10,578 INFO SchemaExport:173 - schema export complete
[java] 14:06:10,578 WARN JDBCExceptionReporter:48 - SQL Warning: 0, SQLState: 01I01
[java] 14:06:10,593 WARN JDBCExceptionReporter:49 - Database has transactions
[java] 14:06:10,593 WARN JDBCExceptionReporter:48 - SQL Warning: 0, SQLState: 01I04
[java] 14:06:10,593 WARN JDBCExceptionReporter:49 - Database selected
[java] 14:06:10,609 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:informix-sqli://desa:5555/basurero:INFORMIXSERVER=impedb
[java] 14:06:10,625 INFO SessionFactoryImpl:379 - Checking 0 named queries
[java] 14:06:10,750 DEBUG JDBCTransaction:46 - begin
[java] 14:06:10,765 DEBUG ConnectionManager:296 - opening JDBC connection
[java] 14:06:10,765 DEBUG JDBCTransaction:50 - current autocommit status: false
[java] 14:06:10,796 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[java] 14:06:10,796 DEBUG SQL:324 - insert into EVENTS (EVENT_DATE, title) values (?, ?)
[java] Hibernate: insert into EVENTS (EVENT_DATE, title) values (?, ?)
[java] 14:06:10,796 DEBUG AbstractBatcher:378 - preparing statement
[java] 14:06:10,828 WARN JDBCExceptionReporter:71 - SQL Error: -206, SQLState: 42000
[java] 14:06:10,828 ERROR JDBCExceptionReporter:72 - The specified table (events) is not in the database.
[java] 14:06:10,828 WARN JDBCExceptionReporter:71 - SQL Error: -111, SQLState: IX000
[java] 14:06:10,828 ERROR JDBCExceptionReporter:72 - ISAM error: no record found.
[java] 14:06:10,828 WARN JDBCExceptionReporter:71 - SQL Error: -206, SQLState: 42000
[java] 14:06:10,828 ERROR JDBCExceptionReporter:72 - The specified table (events) is not in the database.
[java] 14:06:10,828 WARN JDBCExceptionReporter:71 - SQL Error: -111, SQLState: IX000
[java] 14:06:10,828 ERROR JDBCExceptionReporter:72 - ISAM error: no record found.
[java] Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [Event]
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1777)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2178)
[java] at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
[java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:240)
[java] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
[java] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
[java] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
[java] at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)
[java] Caused by: java.sql.SQLException: The specified table (events) is not in the database.
[java] at com.informix.jdbc.IfxSqli.addException(IfxSqli.java:3105)
[java] at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java:3419)
[java] at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2282)
[java] at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2202)
[java] at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1093)
[java] at com.informix.jdbc.IfxResultSet.executePrepare(IfxResultSet.java:189)
[java] at com.informix.jdbc.IfxPreparedStatement.setupExecutePrepare(IfxPreparedStatement.java:193)
[java] at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:171)
[java] at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:1964)
[java] at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:396)
[java] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1739)
[java] ... 15 more
[java] Java Result: 1
Name and version of the database you are using:
[java] 14:06:08,859 INFO SettingsFactory:77 - RDBMS: INFORMIX-OnLine, version: 7.31.UC7
[java] 14:06:08,875 INFO SettingsFactory:78 - JDBC driver: IBM Informix JDBC Driver for IBM Informix Dynamic Server, version: 2.21.JC6
[java] 14:06:08,906 INFO Dialect:92 - Using dialect: org.hibernate.dialect.InformixDialect
The generated SQL (show_sql=true):
[java] 14:06:10,562 DEBUG SchemaExport:161 - create table EVENTS (
[java] EVENT_ID serial8 not null,
[java] EVENT_DATE datetime year to fraction(5),
[java] title varchar(255),
[java] primary key (EVENT_ID)
[java] )
[java] 14:06:10,578 ERROR SchemaExport:167 - Unsuccessful: create table EVENTS (EVENT_ID serial8 not null, EVENT_DATE datetime year to fraction(5), title varchar(255), primary key (EVENT_ID))
[java] 14:06:10,578 ERROR SchemaExport:168 - A syntax error has occurred.
Debug level Hibernate log excerpt:
_________________ A.U.S. Enrique Ferreyra
Red Megatone
Santa Fe - Argentina
|