I learned that to configure c3p0 pooling in hibernate, we can have write the configuration in hibernate.cfg.xml such this:
Here is a sample configuration (from our application) on how to configure c3p0 in the datasource:
We use an external property file to configure some parameters, but they can be configured directly in Spring too.
If you want hibernate to take care of the pooling, then you need to configure the Session properties:
net.sf.hibernate.dialect.Oracle9Dialect
net.sf.hibernate.transaction.JDBCTransactionFactory
net.sf.hibernate.transaction.JDBCTransactionFactory
false
false
0
You must use one of the approaches: either pool at the datasource or pool at the hibernate Session. Never use both, as it wastes resources.