-->
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.  [ 1 post ] 
Author Message
 Post subject: BatchedTooManyRowsAffectedException
PostPosted: Thu Sep 27, 2007 7:51 am 
Newbie

Joined: Thu Sep 27, 2007 7:11 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2

Mapping documents:<hibernate-configuration>
- <session-factory>
- <!-- Database connection settings
-->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/test</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
- <!-- JDBC connection pool (use the built-in)
-->
- <!-- SQL dialect
-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
- <!-- Enable Hibernate's automatic session context management
-->
<property name="current_session_context_class">thread</property>
- <!-- Disable the second-level cache
-->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
- <!-- Echo all executed SQL to stdout
-->
<property name="show_sql">true</property>
- <!-- Drop and re-create the database schema on startup
-->
<property name="connection.pool_size">3</property>
<property name="jdbc.batch_size">2</property>
<mapping resource="events/Event.hbm.xml" />
</session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (
?, ?, ?)
[java] 07:05:35,593 DEBUG AbstractBatcher:484 - preparing statement
[java] 07:05:35,593 DEBUG AbstractEntityPersister:1992 - Dehydrating entity
: [events.Event#1]
[java] 07:05:35,593 DEBUG TimestampType:133 - binding '2007-08-27 07:05:26'
to parameter: 1
[java] 07:05:35,609 DEBUG StringType:133 - binding 'My Event' to parameter:
2
[java] 07:05:35,609 DEBUG IntegerType:133 - binding '1' to parameter: 3
[java] 07:05:35,609 DEBUG AbstractBatcher:44 - Executing batch size: 1
[java] 07:05:35,703 ERROR AbstractBatcher:51 - Exception executing batch:
[java] org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update
returned unexpected row count from update [0]; actual row count: 7810893; expec
ted: 1



Name and version of the database you are using: MYSQL5.1

The generated SQL (show_sql=true):[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (
?, ?, ?)
[java] 07:05:35,593 DEBUG TimestampType:133 - binding '2007-08-27 07:05:26'
to parameter: 1
[java] 07:05:35,609 DEBUG StringType:133 - binding 'My Event' to parameter:
2
[java] 07:05:35,609 DEBUG IntegerType:133 - binding '1' to parameter: 3


JDBC:Connector/J 5.0

this problem only in save(), Query is OK, native SQL
Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (
'2007-08-27 07:05:26'
, 'My Event' , 1) OK



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

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.