[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1113) idbag composite-element cascade-on-save gives "could not bind value POST_INSERT_INDICATOR to" collection-id
Brian Leathem (JIRA)
noreply at atlassian.com
Thu Jun 24 16:52:09 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37577#action_37577 ]
Brian Leathem commented on HHH-1113:
------------------------------------
I was about to file this same bug, but found this issue in a search. I don't see anywhere in the documentation that this is a limitation. I do see a documented limitation for the idbag generator strategy "native", but not for the "identity" strategy used here. Can this bug be re-opened? Or maybe the documentation should be corrected?
> idbag composite-element cascade-on-save gives "could not bind value POST_INSERT_INDICATOR to" collection-id
> -----------------------------------------------------------------------------------------------------------
>
> Key: HHH-1113
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1113
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5, 3.1 rc 1, 3.1 rc2
> Environment: MySQL any, MSSQL any
> Reporter: Tea Yu
> Priority: Blocker
>
> - Parent contains a List of composite-element childs (idbag)
> - the collection is cascade on all-delete-orphan
> - when saving a parent, child couldn't be persisted due to "could not bind value 'POST_INSERT_INDICATOR' to parameter", which is supposed to be generated in DB
> ------------------
> mapping
> ------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC
> "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <hibernate-mapping>
> <class name="Parent" table="parent">
> <id name="id" column="parent_id" type="long" unsaved-value="0">
> <generator class="native" />
> </id>
> <idbag name="childs" table="childs" cascade="all-delete-orphan">
> <collection-id column="child_id" type="long">
> <generator class="identity">
> <param name="unsaved-value">0</param>
> </generator>
> </collection-id>
> <key column="_parent_id" />
> <composite-element class="Child">
> <property name="name" column="name" type="string" />
> </composite-element>
> </idbag>
> </class>
> </hibernate-mapping>
> ------------------
> stack trace
> ------------------
> 31/10/2005 17:16:20 - DEBUG [main] (AbstractBatcher.java:344) - insert into childs (_parent_id, child_id, name) values (?, ?, ?)
> 31/10/2005 17:16:20 - DEBUG [main] (AbstractBatcher.java:413) - preparing statement
> 31/10/2005 17:16:20 - DEBUG [main] (NullableType.java:79) - binding '14' to parameter: 1
> 31/10/2005 17:16:20 - DEBUG [main] (NullableType.java:79) - binding 'POST_INSERT_INDICATOR' to parameter: 2
> 31/10/2005 17:16:20 - INFO [main] (NullableType.java:89) - could not bind value 'POST_INSERT_INDICATOR' to parameter: 2
> 31/10/2005 17:16:20 - DEBUG [main] (NullableType.java:79) - binding 'test' to parameter: 3
> 31/10/2005 17:16:20 - DEBUG [main] (BatchingBatcher.java:28) - Adding to batch
> 31/10/2005 17:16:20 - DEBUG [main] (AbstractCollectionPersister.java:1045) - done inserting collection: 1 rows inserted
> 31/10/2005 17:16:20 - DEBUG [main] (BatchingBatcher.java:55) - Executing batch size: 1
> 31/10/2005 17:16:20 - DEBUG [main] (AbstractBatcher.java:317) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
> 31/10/2005 17:16:20 - DEBUG [main] (AbstractBatcher.java:459) - closing statement
> 31/10/2005 17:16:20 - DEBUG [main] (JDBCExceptionReporter.java:63) - Could not execute JDBC batch update [insert into childs (_parent_id, child_id, name) values (?, ?, ?)]
> java.sql.BatchUpdateException: Statement parameter 2 not set.
> at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:828)
> at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:193)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
> at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
> at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
> at test.Test.testInsert(Test.java:27)
> at test.Test.main(Test.java:15)
--
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