Description
Janning Vygen opened SPR-7226 and commented
See DataSourceUtils.prepareConnectionForTransaction(Connection con, TransactionDefinition definition)
In the catch Block every Exception is catched and silently dropped:
// Set read-only flag.
if (definition != null && definition.isReadOnly()) {
try {
if (logger.isDebugEnabled()) {
logger.debug("Setting JDBC Connection [" + con + "] read-only");
}
con.setReadOnly(true);
}
catch (Throwable ex) {
// SQLException or UnsupportedOperationException
// -> ignore, it's just a hint anyway.
logger.debug("Could not set JDBC Connection read-only", ex);
}
}
In the case where i have c3p0.checkoutTimeout set, it silently drops the TimeoutException here.
The TimeoutConnection get thrown when Hibernate trys to start a connection (in doBeginTransaction()). So when your database is overloaded and you have a timeout of 3 Seconds it takes an effective time of 6 seconds to get the exception, when your transaction isReadOnly(). This is annoying, when you really want to have a timeout of 3 seconds in all cases.
Affects: 3.0.2