Hibernate was used in recent projects, but each time the database record was updated. The updated data cannot be found with hibernate. Many tutorials have been found online. Finally found to be resolved by changing hibernate's default connection pool.
After you replace Hibernate's default connection pool by using the C3P0 connection pool. will be able to find the MySQL updated data.
The detailed change method is 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