public int performExecuteUpdate(QueryParameters queryParameters,
SessionImplementor session) throws HibernateException {
coordinateSharedCacheCleanup( session );
if(queryParameters.isCallable()) {
throw new IllegalArgumentException("callable not yet supported for native queries");
}
int result = 0;
PreparedStatement ps = null;
try {
queryParameters.processFilters( this.customQuery.getSQL(),
session );
String sql = queryParameters.getFilteredSQL();
ps = session.getBatcher().prepareStatement( sql );
try {
int col = 1;
col += bindPositionalParameters( ps, queryParameters, col,
session );
col += bindNamedParameters( ps, queryParameters
.getNamedParameters(), col, session );
result = ps.executeUpdate();
}
finally {
if ( ps != null ) {
session.getBatcher().closeStatement( ps );
}
}
}
catch (SQLException sqle) {
throw JDBCExceptionHelper.convert( session.getFactory()
.getSQLExceptionConverter(), sqle,
"could not execute native bulk manipulation query", this.sourceQuery );
}
return result;
}
|