I configured C3P0 via persistence.xml, however, when I try to retrieve the configuration values via ComboPooledDataSource, the received values differ from what was configured in the configuration file.
<properties>
<!-- Configurações específicas do Hibernate -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<!-- Propriedades JDBC -->
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/financas" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="123" />
<property name="connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/>
<property name="hibernate.c3p0.min_size" value="10" />
<property name="hibernate.c3p0.max_size" value="20" />
<property name="hibernate.c3p0.acquire_increment" value="1" />
<property name="hibernate.c3p0.idle_test_period" value="3000" />
<property name="hibernate.c3p0.max_statements" value="50" />
<property name="hibernate.c3p0.timeout" value="1800" />
<property name="hibernate.c3p0.minPoolSize" value="10"/>
<property name="hibernate.c3p0.maxPoolSize" value="20"/>
</properties>
And in Java:
EntityManager em = JPAUtil.getEntityManager();
ComboPooledDataSource ds = new ComboPooledDataSource();
System.out.println("Numero de conexoes: " + ds.getMaxPoolSize());
I think the value returned by getMaxPoolSize () should be 20, but it is returning 15.
What now? how to load persistence.xml settings in ComboPooledDataSource?
----------------- UPDATED ---------
I added the properties:
<property name="hibernate.c3p0.minPoolSize" value="10"/>
<property name="hibernate.c3p0.maxPoolSize" value="20"/>
But the java continues to return maxPoolSize = 15 and now?