These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SQLIntegrityConstraintViolationException class.
public static SQLException newSQLFeatureNotSupportedException(String reason, String SQLState, int vendorCode) { return new SQLFeatureNotSupportedException(reason, SQLState, vendorCode); } public static SQLException newSQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode) { return new SQLIntegrityConstraintViolationException(reason, SQLState, vendorCode); } public static SQLException newSQLInvalidAuthorizationSpecException(String reason, String SQLState, int vendorCode) { return new SQLInvalidAuthorizationSpecException(reason, SQLState, vendorCode); } public static SQLException newSQLNonTransientConnectionException(String reason, String SQLState, int vendorCode) { return new SQLNonTransientConnectionException(reason, SQLState, vendorCode); } public static SQLException newSQLSyntaxErrorException(String reason, String SQLState, int vendorCode) { return new SQLSyntaxErrorException(reason, SQLState, vendorCode); }
* @test java.sql.SQLIntegrityConstraintViolationException(String, String, * int, Throwable) */ public void test_Constructor_LStringLStringILThrowable_18() { Throwable cause = new Exception("MYTHROWABLE"); SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException( null, null, 1, cause); assertNotNull(sQLIntegrityConstraintViolationException); assertNull( "The SQLState of SQLIntegrityConstraintViolationException should be null", sQLIntegrityConstraintViolationException.getSQLState()); assertNull( "The reason of SQLIntegrityConstraintViolationException should be null", sQLIntegrityConstraintViolationException.getMessage()); assertEquals( "The error code of SQLIntegrityConstraintViolationException should be 1", sQLIntegrityConstraintViolationException.getErrorCode(), 1); assertEquals( "The cause of SQLIntegrityConstraintViolationException set and get should be equivalent", cause, sQLIntegrityConstraintViolationException.getCause());
code, cause); } } else if (sqlstate.startsWith("22")) { return new SQLDataException(msg, sqlstate, code, cause); } else if (sqlstate.startsWith("23")) { return new SQLIntegrityConstraintViolationException(msg, sqlstate, code, cause); } else if (sqlstate.startsWith("28")) { return new SQLInvalidAuthorizationSpecException(msg, sqlstate, code, cause); } else if (sqlstate.startsWith("42") || sqlstate.startsWith("37") || sqlstate.startsWith("2A")) { // TODO: // // First, the overview section of java.sql.SQLSyntaxErrorException // // "...thrown when the SQLState class value is '<i>42</i>'" // // appears to be inaccurate or not in sync with the