Configure connection Release mode when Spring integrates hibernate

Source: Internet
Author: User

http://zmfkplj.iteye.com/blog/220822
The program appears a strange phenomenon, with quartz job scheduling start task, after running for a period of time, the task will be stuck in a query interface, long can not run finished. I instinctively discovered that the number of database connection pools is not enough? So I added the size of the connection pool. However, the problem still arises. At this point, I can only use Debug+log to debug. Debugging found that when the query interface to perform the stuck phenomenon, the program connection pool is really not enough, but the other tasks have been run out of time, beginning and end, when the previous task runs out, it occupies the connection should be released Ah, so the connection will not exist enough AH. The Epiphany is that the connection is released with problems. Now the database connection is given to hibernate management, before the hibernate environment is another developer configuration, no problem before, not much attention. Now there is no way, to look at the configuration. After reading the spring configuration, there is a problem. Now configure the connection release mode is On_close, set it to auto after the good.       <Bean            class= "Org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"            ID= "Localhost_oracle">            < Propertyname= "DataSource" ref= "Localhost_oracleds"/>            < Propertyname= "Persistenceunitname"value= "Localhost_oracle"/>            < Property name= "Jpavendoradapter"ref= "Localhost_oraclejpavendoradapter"/>             < Propertyname= "Jpapropertymap">                  <Map>                        <entryKey= "Hibernate.transaction.manager_lookup_class"                              value= "Com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup"/><!--<entry key= "Hibernate.connection.release_mode" value= "On_close"/>-->                        <entryKey= "Hibernate.connection.release_mode"value= "Auto"/>                  </Map>            </ Property>      </Bean> I think on_close means that when the thread that is currently using the connection shows that the thread has died off or has finished running, the connection is freed. Connection Release configuration: <property name= "Hibernate.connection.release_mode" >auto</property>More articles: Questions about Hibernate connection pooling not enough-http://zmfkplj.iteye.com/blog/220822

Configure connection Release mode when Spring integrates hibernate

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.