ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Barlow" <garybar...@hotmail.com>
Subject Batch not batching!
Date Tue, 18 Oct 2005 08:55:00 GMT
Hi there, I'm using v2.1.5 with spring and attempting to use batched 
statements but it doesn't seem to batch! The code below functions fine but 
when testing for duplicate inserts I noticed if failed on the insert rather 
than the executeBatch() statement. This suggests it's not batching! Also 
noticed that the count returned from execute batch is always zero.

Have I coded this corrrectly? Are there any know issues?

public class SqlMapParameterDao extends SqlMapClientDaoSupport implements 
ParameterDao {

............................

public void saveParameterValues(final Parameter parameter, final List vals) 
throws IntegrityViolationException {
try {

this.getSqlMapClient().startBatch();
for (int i = 0; i < pvals.size(); i++) {
ParameterValue parameterValue = (ParameterValue) pvals.get(i);
this.getSqlMapClient().insert("insertParameterValue", new 
ParameterValueCriteria(parameterValue.getParameter().getId(), 
parameterValue));
}
int count = this.getSqlMapClient().executeBatch();
} catch (SQLException e) {
throw new IntegrityViolationException(e.getMessage());
}
}



Mime
View raw message