Hibernate cannot get updates to MySQL database in real time

Source: Internet
Author: User

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

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.