Hibernate is used in recent projects, but after each database record has been updated, it is not possible to find the updated data with Hibernate. A number of tutorials have been found on the web and eventually discovered by changing hibernate's default connection pool can be resolved. After you replace Hibernate's default connection pool with the C3P0 connection pool, you can find the MySQL updated data.
The specific modifications are as follows:
In the Hibernate.cfg.xml configuration file, add the following:
<property name= "Hibernate.connection.provider_class" >org.hibernate.connection.c3p0connectionprovider</ property> <property name= "hibernate.c3p0.max_size" >20</property> <!-- Maximum number of database connections available in a connection pool- <property name= "hibernate.c3p0.min_size" >5</property> <!-- Minimum number of database connections available in the connection pool-- <property name= "hibernate.c3p0.max_statements" >100</property> < Property Name= "Hibernate.c3p0.idle_test_period" >120</property> <property name= " Hibernate.c3p0.acquire_increment ">1</property> <property name=" C3p0.testconnectiononcheckout " >true</property> <property name= "C3p0.idleconnectiontestperiod" >18000</property> <property name= "C3p0.maxidletime" >25000</property>
Attach c3p0 jar package,: http://download.csdn.net/detail/until_v/8149191
Hibernate cannot get updates to MySQL database in real time