All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cds.jdbc.generic.GenericExceptionAnalyzer Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show 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";

    public boolean isUniqueConstraint(SQLException ex) {
        return UNIQUE_CONSTRAINT_ERROR_CODE.equals(ex.getSQLState());
    }

    public boolean isNotNullConstraint(SQLException ex) {
        return NOT_NULL_CONSTRAINT_ERROR_CODE.equals(ex.getSQLState());
    }

    public boolean isLockTimeout(SQLException ex) {
        return ex instanceof SQLTimeoutException;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy