I am trying to catch SQLException
on mybatis but it is not allowing me to use this.
try{
session.insert("insertMyData", insertData);
}
catch (SQLException sqle) { // mybatis not supporting SQLException
//exception handling code
}
so instead I try to use SqlSessionException
try{
session.insert("insertMyData", insertData);
}
catch (SqlSessionException sqle) { // mybatis support this
//exception handling code
}
but the issue using this is is not all SQL exceptions are caught. if I try to insert duplicate data it is not catching SQLIntegrityConstraintViolationException
Is there a way to catch all SQL exception in mybatis.