Java 类org.springframework.dao.IncorrectUpdateSemanticsDataAccessException 实例源码

项目:FinanceAnalytics    文件:AbstractDocumentDbMaster.java   
/**
 * Updates the document row to mark the version as ended.
 *
 * @param document  the document to update, not null
 */
protected void updateVersionToInstant(final D document) {
  final DbMapSqlParameterSource args = createParameterSource()
    .addValue("doc_id", extractRowId(document.getUniqueId()))
    .addTimestamp("ver_to_instant", document.getVersionToInstant())
    .addValue("max_instant", DbDateUtils.MAX_SQL_TIMESTAMP);
  final String sql = getElSqlBundle().getSql("UpdateVersionToInstant", args);
  final int rowsUpdated = getJdbcTemplate().update(sql, args);
  if (rowsUpdated != 1) {
    throw new IncorrectUpdateSemanticsDataAccessException("Update end version instant failed, rows updated: " + rowsUpdated);
  }
}
项目:FinanceAnalytics    文件:AbstractDocumentDbMaster.java   
/**
 * Updates the document row to mark the correction as ended.
 *
 * @param document  the document to update, not null
 */
protected void updateCorrectionToInstant(final AbstractDocument document) {
  final DbMapSqlParameterSource args = createParameterSource()
    .addValue("doc_id", extractRowId(document.getUniqueId()))
    .addTimestamp("corr_to_instant", document.getCorrectionToInstant())
    .addValue("max_instant", DbDateUtils.MAX_SQL_TIMESTAMP);
  final String sql = getElSqlBundle().getSql("UpdateCorrectionToInstant", args);
  final int rowsUpdated = getJdbcTemplate().update(sql, args);
  if (rowsUpdated != 1) {
    throw new IncorrectUpdateSemanticsDataAccessException("Update end correction instant failed, rows updated: " + rowsUpdated);
  }
}