In my java hibernate application I am getting the following error message, although the application continues to run after the message is displayed:
o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 17008, SQLState: 99999
o.h.e.jdbc.spi.SqlExceptionHelper - Closed Connection
If this occurs I want the application to stop.
I have implemented the following but it is not stopping the application if this "closed connection" occurs:
Current Code:
try {
personName = findPersonNameById(id); //hibernate query method
} catch (Exception e) {
throw new ClosedConnectionException("Closed connection error");
}
Custom exception class:
public class ClosedConnectionException extends RuntimeException {
public ClosedConnectionException(String message) {
super(message);
}
}
For reference, here is my persistence.xml C3PO values, could something here be causing the connection to close? :
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.connection.provider_class" value="org.hibernate.c3p0.internal.C3P0ConnectionProvider"/>
<property name="hibernate.c3p0.max_size" value="1"/>
<property name="hibernate.c3p0.min_size" value="1"/>
<property name="hibernate.c3p0.acquire_increment" value="2"/>
<property name="hibernate.c3p0.idle_test_period" value="300"/>
<property name="hibernate.c3p0.max_statements" value="15"/>
<property name="hibernate.c3p0.timeout" value="0"/>
<property name="hibernate.c3p0.unreturnedConnectionTimeout" value="30000"/>
<property name="hibernate.c3p0.dataSourceName" value="My connection"/>
<property name="hibernate.jdbc.fetch_size" value="50"/>
<property name="hibernate.default_batch_fetch_size" value="10"/>
</properties>