protected void batchOrExecuteRow(RowImpl row) throws SQLException { String sql = row.getSQL(_dict); if (_batchedSql == null) { // brand new SQL _batchedSql = sql; } else if (!sql.equals(_batchedSql)) { // SQL statements changed. switch (_batchedRows.size()) { case 0: break; case 1: // single entry in cache, direct SQL execution. try { super.flushAndUpdate((RowImpl) _batchedRows.get(0)); } finally { _batchedSql = null; _batchedRows.clear(); } break; default: // flush all entries in cache in batch. flushBatch(); } _batchedSql = sql; } _batchedRows.add(row); }
protected void batchOrExecuteRow(RowImpl row) throws SQLException { String sql = row.getSQL(_dict); if (_batchedSql == null) { // brand new SQL _batchedSql = sql; } else if (!sql.equals(_batchedSql)) { // SQL statements changed. switch (_batchedRows.size()) { case 0: break; case 1: // single entry in cache, direct SQL execution. try { super.flushAndUpdate((RowImpl) _batchedRows.get(0)); } finally { _batchedSql = null; _batchedRows.clear(); } break; default: // flush all entries in cache in batch. flushBatch(); } _batchedSql = sql; } _batchedRows.add(row); }
protected void batchOrExecuteRow(RowImpl row) throws SQLException { String sql = row.getSQL(_dict); if (_batchedSql == null) { // brand new SQL _batchedSql = sql; } else if (!sql.equals(_batchedSql)) { // SQL statements changed. switch (_batchedRows.size()) { case 0: break; case 1: // single entry in cache, direct SQL execution. try { super.flushAndUpdate((RowImpl) _batchedRows.get(0)); } finally { _batchedSql = null; _batchedRows.clear(); } break; default: // flush all entries in cache in batch. flushBatch(); } _batchedSql = sql; } _batchedRows.add(row); }
protected void batchOrExecuteRow(RowImpl row) throws SQLException { String sql = row.getSQL(_dict); if (_batchedSql == null) { // brand new SQL _batchedSql = sql; } else if (!sql.equals(_batchedSql)) { // SQL statements changed. switch (_batchedRows.size()) { case 0: break; case 1: // single entry in cache, direct SQL execution. try { super.flushAndUpdate((RowImpl) _batchedRows.get(0)); } finally { _batchedSql = null; _batchedRows.clear(); } break; default: // flush all entries in cache in batch. flushBatch(); } _batchedSql = sql; } _batchedRows.add(row); }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { row.flush(ps, _dict, _store); int count = ps.executeUpdate(); if (count != 1) { Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
private void flushSingleRow(RowImpl row, PreparedStatement ps) throws SQLException { if (ps != null) row.flush(ps, _dict, _store); int count = executeUpdate(ps, row.getSQL(_dict), row); if (count != 1) { logSQLWarnings(ps); Object failed = row.getFailedObject(); if (failed != null) _exceptions.add(new OptimisticException(failed)); else if (row.getAction() == Row.ACTION_INSERT) throw new SQLException(_loc.get("update-failed-no-failed-obj", String.valueOf(count), row.getSQL(_dict)).getMessage()); } }
String sql = row.getSQL(_dict); if (_batchedSql == null) {
"update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); break; case Statement.SUCCESS_NO_INFO: // -2 "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); row.getSQL(_dict)).getMessage()); break; case 0: // no row is inserted, treats it as failed "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage());
"update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); break; case Statement.SUCCESS_NO_INFO: // -2 "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); row.getSQL(_dict)).getMessage()); break; case 0: // no row is inserted, treats it as failed "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage());
"update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); break; case Statement.SUCCESS_NO_INFO: // -2 "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); row.getSQL(_dict)).getMessage()); break; case 0: // no row is inserted, treats it as failed "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage());
"update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); break; case Statement.SUCCESS_NO_INFO: // -2 "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage()); row.getSQL(_dict)).getMessage()); break; case 0: // no row is inserted, treats it as failed "update-failed-no-failed-obj", String.valueOf(count[i]), row.getSQL(_dict)).getMessage());
throws SQLException { String sql = row.getSQL(_dict); PreparedStatement stmnt = prepareStatement(sql);
private boolean isBatchDisabled(RowImpl row) { boolean rtnVal = true; if (_batchLimit != 0 && !_disableBatch) { String sql = row.getSQL(_dict); OpenJPAStateManager sm = row.getPrimaryKey(); ClassMapping cmd = null; if (sm != null) cmd = (ClassMapping) sm.getMetaData(); Column[] autoAssign = null; if (row.getAction() == Row.ACTION_INSERT) autoAssign = row.getTable().getAutoAssignedColumns(); // validate batch capability _disableBatch = _dict .validateBatchProcess(row, autoAssign, sm, cmd); rtnVal = _disableBatch; } return rtnVal; }
String sql = row.getSQL(_dict); PreparedStatement stmnt = prepareStatement(sql, autoAssignColNames);
String sql = row.getSQL(_dict); PreparedStatement stmnt = prepareStatement(sql, autoAssignColNames);
String sql = row.getSQL(_dict); PreparedStatement stmnt = prepareStatement(sql, autoAssignColNames);
String sql = row.getSQL(_dict); PreparedStatement stmnt = prepareStatement(sql, autoAssignColNames);