我的应用程序使用 JBOSS 7.1 Web 服务器。我配置了 JBOSS 连接池并将其用于 JDBC 连接。我还在我的应用程序中使用 hibernate 。我想知道hibernate是否也使用这个连接池或者我需要为hibernate配置其他连接池(例如c3p0)?
最佳答案
C3P0连接池
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
hibernate.c3p0.min_size
:
- 池中 JDBC 连接的最小数量。
- hibernate 默认值:1
hibernate.c3p0.max_size
:
- 池中 JDBC 连接的最大数量。
- hibernate 默认值:100
hibernate.c3p0.timeout
:
- 当空闲连接从池中删除时(以秒为单位)。
- hibernate 默认值:0,永不过期。
hibernate.c3p0.max_statements
:
- 将缓存的准备语句数量。提高性能。
- Hibernate 默认值:0,禁用缓存。
hibernate.c3p0.idle_test_period
:
- 自动验证连接之前的空闲时间(以秒为单位)。
- hibernate 默认值:0
http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch01.html
关于java - Hibernate也像JDBC一样使用连接池吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26295075/