Now I'm using Hibernate, MySql and Websphere, MySql has 8 hours timeout, after timeout, my application can't connect to MySql first, but second time it is ok.
I tried to use C3P0 connection pool in hibernate configure file, but it is still unsucessful.
the following is my cfg file.
<hibernate-configuration>
<session-factory>
<!-- Database connection settings --> <property name="connection.datasource">java:comp/env/jdbc/loyaltycentral</property> <!-- <property name="transaction.manager_lookup_class"> org.hibernate.transaction.WebSphereExtendedJTATransactionLookup </property> <property name="transaction.factory_class"> org.hibernate.transaction.JTATransactionFactory </property> --> <property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.max_size">80</property> <property name="hibernate.c3p0.timeout">8</property> <property name="hibernate.c3p0.max_statements">500</property> <property name="hibernate.c3p0.idle_test_period">10</property> <property name="hibernate.c3p0.acquire_increment">2</property> <property name="connection.autoReconnect">true</property> <property name="connection.autoReconnectForPools">true</property> <property name="connection.is-connection-validation-required">true</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management --> <property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache --> <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- <property name="hibernate.jdbc.use_get_generated_keys">true</property> --> <mapping resource="hbmappings/OrganisationHierarchy.hbm.xml"/>
Anybody knows the reason? thanks
|