-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: idbag mapping problem
PostPosted: Wed May 23, 2007 1:12 pm 
Newbie

Joined: Tue May 08, 2007 12:25 am
Posts: 18
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 6:37 am 
Newbie

Joined: Mon Sep 26, 2005 8:43 am
Posts: 16
imosquer,

I also had similar problem. I came across a thread that says that native and identity doesn't work with idbag. So I tried 'increment' and it worked fine. I hope this helps you.

_________________
--Beejal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.