Hi,
I want to send eclipselink logging to Log4j logger. Is it possible to create logging customizer and pass the log4j logger/appender (print writer)
I am using Spring + EclipseLink integration. Currently database exception are wrapped in spring DataAccessException. I want to display the sql error code with the error message. I would like to use
SQLErrorCodeSQLExceptionTranslator and inject eclipselink (oracle db specific) CustomSQLErrorCodesTranslation. Or use SQLErrorCodesFactory to get the SqlErrorCode and wrapped in a exception ....Any suggestions???
public void testDefaultInstanceWithNoSuchDatabase() {
SQLErrorCodes sec = SQLErrorCodesFactory.getInstance().getErrorCodes("xx");
assertTrue(sec.getBadSqlGrammarCodes().length == 0);
assertTrue(sec.getDataIntegrityViolationCodes().length == 0);
}
/**
* Check that a known database produces recognizable codes.
*/
public void testDefaultInstanceWithOracle() {
SQLErrorCodes sec = SQLErrorCodesFactory.getInstance().getErrorCodes("Oracle");
assertIsOracle(sec);
}
private void assertIsOracle(SQLErrorCodes sec) {
assertTrue(sec.getBadSqlGrammarCodes().length > 0);
assertTrue(sec.getDataIntegrityViolationCodes().length > 0);
// This had better be a Bad SQL Grammar code
assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "942") >= 0);
// This had better NOT be
assertFalse(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "9xx42") >= 0);
}
OR
EclipseLink team is already have some inbuilt support for it.