在HIbernate 的配置文件中加入下面内容:
## DBCP Connection Pool
hibernate.dbcp.maxActive 100
hibernate.dbcp.whenExhaustedAction 1
hibernate.dbcp.maxWait 120000
hibernate.dbcp.maxIdle 10
## prepared statement cache
hibernate.dbcp.ps.maxActive 100
hibernate.dbcp.ps.whenExhaustedAction 1
hibernate.dbcp.ps.maxWait 120000
hibernate.dbcp.ps.maxIdle 100
## optional query to validate pooled connections:
hibernate.dbcp.validationQuery select 1 from dual
hibernate.dbcp.testOnBorrow true
hibernate.dbcp.testOnReturn false