Hibernate version:
3.0
Mapping documents:
<idbag name="friends" table="users_friends">
<collection-id column="id" type="long">
<generator class="identity" />
</collection-id>
<key column="user_id"/>
<many-to-many column="friend_user_id" class="com.familyoven.user.User" />
</idbag>
java code between session.open/close
User user = new User(234);
List<User> friends = new ArrayList<User>();
User friend = new User(212);
friends.add( friend );
user.setFriends( friends )
Full stack trace of any exception that occurs:
05/23/07 09:51:05,091 INFO SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
05/23/07 09:51:05,743 INFO NullableType - could not bind value 'POST_INSERT_INDICATOR' to parameter: 2
05/23/07 09:51:05,758 WARN JDBCExceptionReporter - SQL Error: 0, SQLState: S1009
05/23/07 09:51:05,758 ERROR JDBCExceptionReporter - Statement parameter 2 not set.
05/23/07 09:51:05,761 ERROR AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
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:1009)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at sandbox.ServiceTest.main(ServiceTest.java:70)
Caused by: java.sql.BatchUpdateException: Statement parameter 2 not set.
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
... 8 more
Name and version of the database you are using:
MySQL 5.0
The generated SQL (show_sql=true):
insert into users_friends (user_id, id, friend_user_id) values (?, ?, ?)
when I try to add a user to the "friends" collection it shows me this:
NullableType - could not bind value 'POST_INSERT_INDICATOR' to parameter: 2
|