1 16 17 package org.springframework.jdbc; 18 19 import org.springframework.dao.IncorrectUpdateSemanticsDataAccessException; 20 21 29 public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectUpdateSemanticsDataAccessException { 30 31 32 private int expected; 33 34 35 private int actual; 36 37 38 44 public JdbcUpdateAffectedIncorrectNumberOfRowsException(String sql, int expected, int actual) { 45 super("SQL update '" + sql + "' affected " + actual + " rows, not " + expected + " as expected"); 46 this.expected = expected; 47 this.actual = actual; 48 } 49 50 51 54 public int getExpectedRowsAffected() { 55 return this.expected; 56 } 57 58 61 public int getActualRowsAffected() { 62 return this.actual; 63 } 64 65 public boolean wasDataUpdated() { 66 return (getActualRowsAffected() > 0); 67 } 68 69 } 70 | Popular Tags |