Hraní si s PersistenceException
-> SQLException
-> getErrorCode()
, Schovávám specifickou chybu Oracle ve svém deníku. Problém je podle mého server.log
já stále nalézt řádky jako:
WARN 25 Sep 2018 12:14:47,121 - id - org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ms 5829302 SQL Error: 13333, SQLState: 72000
ERROR 25 Sep 2018 12:14:47,121 - id - org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ms 5829302 ORA-13333: invalid LRS measure
ORA-06512: at MDSYS.SDO_LRS, line 3149
ORA-06512: at line 1
které nejsou výslovně přihlásit skrze mne.
Zde je můj kód:
try {
try {
//business stuff
} catch (PersistenceException persEx) {
if (persEx.getCause() != null && persEx.getCause() instanceof GenericJDBCException) {
GenericJDBCException jdbcEx = (GenericJDBCException) persEx.getCause();
SQLException sqlEx = (SQLException) jdbcEx.getCause();
if (sqlEx.getErrorCode() == 13333) {
//handling ORA-13333: invalid LRS measure as an info
log.info(Possible invalid LRS measure);
} else {
throw persEx; // do not swallow unhandled exceptions
}
} else {
throw persEx; // do not swallow unhandled exceptions
}
} catch (Exception e) {
log.error(Other exception: + e.getMessage());
}
} catch (Exception e) {
log.error(Exception to log: + e.getMessage());
}