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.  [ 3 posts ] 
Author Message
 Post subject: MySQL 4.1 clearParameters problem?
PostPosted: Wed Oct 27, 2004 3:58 pm 
Newbie

Joined: Wed Oct 27, 2004 3:39 pm
Posts: 2
I am using Spring's hibernate support to store an object (it has a couple lists). When i call store, i get the stack trace below. It seems to be from the fact that MySql 4.1 now supports server-side prepared statements. When I change the BatchBatcher (catchy name, btw) and add:
try {
ps.clearParameters();
}
catch (SQLException ignore) {

}

to the fillanally of doExecuteBatch, then I get it to work if the hibernate.jdbc.batch_size is set to 1. If it isn't set to 1 (zero or 2 or more) i get the below problem. It seems there may be a bug in the "executeBatch" method of the mysql driver (i have posted to mysql forum, as well). It also seems, however, that BatchBatcher should have the "clearParameters" call in its finally as i mentioned above. Without that, i cannot get 4.1 to work for this object under any circumstances (no matter what i set batch_size to).

thanks,

John

Hibernate version: 2.1

Full stack trace of any exception that occurs:
2004-10-27 09:50:45,408 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <Driver can not re-execute prepared statement when a parameter has been changed from a streaming type to an intrinsic data type without calling clearParameters() first.>
2004-10-27 09:50:45,418 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <could not update: [org.theospi.portfolio.matrix.model.ReflectionItem#C2258DF2A1180D4E7337062C08B6231F]>
java.sql.BatchUpdateException: Driver can not re-execute prepared statement when a parameter has been changed from a streaming type to an intrinsic data type without calling clearParameters() first.
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:806)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:231)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:684)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2418)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240)
at org.springframework.orm.hibernate.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:214)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:177)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:317)


Name and version of the database you are using:
MySQL 4.1


Top
 Profile  
 
 Post subject: Small correction
PostPosted: Wed Oct 27, 2004 4:02 pm 
Newbie

Joined: Wed Oct 27, 2004 3:39 pm
Posts: 2
class name should be:
net.sf.hibernate.impl.BatchingBatcher
but still a very catchy name


Top
 Profile  
 
 Post subject: hibernate.properties
PostPosted: Thu Oct 06, 2005 7:34 am 
Newbie

Joined: Thu Oct 06, 2005 7:20 am
Posts: 2
Location: Semarang, Indonesia
Change your hibernate.properties so that it contains:

Code:
hibernate.jdbc.use_streams_for_binary false


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.