Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hibernate default connection pooling

Does Hibernate use connection pool by default? If so what is the default value for *connection.pool_size*? Doesn't it conflicts with *hibernate.connection.release_mode*? Isn't the all idea of connection pooling is not closing connections?

like image 537
Adi Baron Avatar asked Apr 02 '13 07:04

Adi Baron


People also ask

What is the default connection pool size in hibernate?

The Hibernate Connection Pool Size property establishes the number of connections that are permitted between the Model repository and the Model Repository Service database. The default value is 10. In deployments with many concurrent connections, you can increase the property to increase performance.

Which connection pool is best for hibernate?

The default connection pool in hibernate is c3p0 named after the star wars character. But hibernate supports also proxool and used to also advertise apache dbcp. For a while DBCP was dormant and fell out of grace. C3P0 is actually used in production in many projects.

How do I find my connection pool size in hibernate?

pool_size indicates the maximum number of pooled connections. So it is better to keep it at a logical count. It depends on your application and DB how much it can handle. 10 is a reasonable count that will typically used as it is sufficient for most cases.


1 Answers

The default hibernate connection pool (which shouldn't be used in production) has a default limit of 1, since it is meant to just be used for simple testing. However this is configurable through the hibernate.properties file, so it's worth checking to see if it's defined there in your project.

The property in question is:

hibernate.connection.pool_size

Information on this is largely contained in this link:

http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html

While this doesn't directly specify the default connection pool size, it does have most of the information you could want on the subject of connection pooling in hibernate.

like image 54
Jordan Robinson Avatar answered Oct 02 '22 08:10

Jordan Robinson