[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2605) Since 3.2.4 no value specified for row id
Juan F Cervera (JIRA)
noreply at atlassian.com
Tue May 15 05:40:04 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26952 ]
Juan F Cervera commented on HHH-2605:
-------------------------------------
I have the same issue, my app. was working fine with 3.2.2 and 3.2.3 but fails with 3.2.4. Notice that in my case I use Informix dialect.
See below the difference of the SQL (captured with the p6spy jdbc driver). In my case the field ID is an Informix serial field which gets auto-incremented by Informix:
3.2.3:
2007-05-14 14:53:08,434|16|2|statement|insert into ACSLOG (VERNO_CTX, ACSDATE, ACSTIME, ACSUSR, DESCR) values (?, ?, ?, ?, ?)|insert into ACSLOG (VERNO_CTX, ACSDATE, ACSTIME, ACSUSR, DESCR) values (0, '2007-05-14', 145307, 'testuser', 'test')
3.2.4:
2007-05-14 14:55:35,018|31|2|statement|insert into ACSLOG (VERNO_CTX, ACSDATE, ACSTIME, ACSUSR, DESCR, ID) values (?, ?, ?, ?, ?, ?)|insert into ACSLOG (VERNO_CTX, ACSDATE, ACSTIME, ACSUSR, DESCR, ID) values (0, '2007-05-14', 145532, 'testuser', test, null)
See the corresponding bit of mapping below:
<id name="id" column="ID" access="field">
<generator class="native" />
</id>
So, 3.2.4 is adding the ID column to the insert statement when it should not, on top of that it is setting its value to null, which conflicts with my table definition (as this is the PK).
Same problem as Igor.
> Since 3.2.4 no value specified for row id
> -----------------------------------------
>
> Key: HHH-2605
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2605
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.4
> Environment: hibernate-3.2.4
> mysql-5.0.27-1.fc6
> mysql-connector-java-5.0.5-bin.jar
> Reporter: Igor A Tarasov
> Attachments: noid.zip, noidTestCase.zip
>
>
> Problem starts in 3.2.4 version, but in 3.2.3 was all right.
> Row ID column is specified as parameter in query, but no value is specified.
> Row ID column is autoincrement in MySQL tabled.
> 10.05.07 14:26:29 DEBUG [btpool0-0]: SQL - insert into PaymentDO (_version, comment, created, customer_id, nalichka, newBalance, payDate, sum, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
> 10.05.07 14:26:29 TRACE [btpool0-0]: AbstractBatcher - preparing statement
> 10.05.07 14:26:29 TRACE [btpool0-0]: AbstractEntityPersister - Dehydrating entity: [org.dicr.isp.data.PaymentDO#<null>]
> 10.05.07 14:26:29 TRACE [btpool0-0]: LongType - binding '0' to parameter: 1
> 10.05.07 14:26:29 TRACE [btpool0-0]: StringType - binding null to parameter: 2
> 10.05.07 14:26:29 TRACE [btpool0-0]: TimestampType - binding '2007-05-10 14:26:29' to parameter: 3
> 10.05.07 14:26:29 TRACE [btpool0-0]: VersionValue - version unsaved-value strategy UNDEFINED
> 10.05.07 14:26:29 TRACE [btpool0-0]: IdentifierValue - id unsaved-value: 0
> 10.05.07 14:26:29 TRACE [btpool0-0]: LongType - binding '18128' to parameter: 4
> 10.05.07 14:26:29 TRACE [btpool0-0]: BooleanType - binding 'false' to parameter: 5
> 10.05.07 14:26:29 TRACE [btpool0-0]: FloatType - binding '3.0' to parameter: 6
> 10.05.07 14:26:29 TRACE [btpool0-0]: TimestampType - binding '2007-05-10 00:00:00' to parameter: 7
> 10.05.07 14:26:29 TRACE [btpool0-0]: FloatType - binding '3.0' to parameter: 8
> 10.05.07 14:26:29 DEBUG [btpool0-0]: AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
> 10.05.07 14:26:29 TRACE [btpool0-0]: AbstractBatcher - closing statement
> 10.05.07 14:26:29 DEBUG [btpool0-0]: JDBCExceptionReporter - could not insert: [org.dicr.isp.data.PaymentDO] [insert into PaymentDO (_version, comment, created, customer_id, nalichka, newBalance, payDate, sum, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]
> java.sql.SQLException: No value specified for parameter 9
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
> at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1674)
> at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1512)
> at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455)
> at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440)
> at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
> at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
> at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
> at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
> at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
> at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
> at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
> at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
> at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
> at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
> at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
> at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
> at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
> at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
> at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
> at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213)
> at org.dicr.isp.data.HibernateDataManager.createPayment(HibernateDataManager.java:692)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list