com.sap.cds.jdbc.generic.GenericExceptionAnalyzer Maven / Gradle / Ivy
The newest version!
package com.sap.cds.jdbc.generic;
import java.sql.SQLException;
import java.sql.SQLTimeoutException;
import com.sap.cds.jdbc.spi.ExceptionAnalyzer;
public class GenericExceptionAnalyzer implements ExceptionAnalyzer {
public static final String NOT_NULL_CONSTRAINT_ERROR_CODE = "23502";
public static final String UNIQUE_CONSTRAINT_ERROR_CODE = "23505";
@Override
public boolean isUniqueConstraint(SQLException ex) {
return UNIQUE_CONSTRAINT_ERROR_CODE.equals(ex.getSQLState());
}
@Override
public boolean isNotNullConstraint(SQLException ex) {
return NOT_NULL_CONSTRAINT_ERROR_CODE.equals(ex.getSQLState());
}
@Override
public boolean isLockTimeout(SQLException ex) {
return ex instanceof SQLTimeoutException;
}
}