Hibernate cannot get updates to MySQL database in real time

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.