]
Steve Ebersole updated HHH-6635:
--------------------------------
Fix Version/s: (was: 4.0.0.next)
4.0.0.CR3
C3P0: hibernate.c3p0.* configuration properties not properly parsed
-------------------------------------------------------------------
Key: HHH-6635
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6635
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.CR1, 4.0.0.CR2
Reporter: Guenther Demetz
Assignee: Strong Liu
Labels: c3p0
Fix For: 4.0.0.CR3
Attachments: C3P0ConnectionProvider.java, C3P0TestCase.jar
Original Estimate: 1h
Remaining Estimate: 1h
testing Hibernate4.0.0 CR 2
I discovered that unfortunately there is still a problem using C3P0 as
ConnectionProvider:
Though my patch provided with HHH-6327 made C3P0 work again,
hibernate-c3p0 specific parameters such as hibernate.c3p0.max_size are not passed
correctly to C3P0 anymore.
The reason is that providing the patch for HHH-6327 I was not aware that the methods
com.mchange.v2.c3p0.DataSources.java
public static DataSource pooledDataSource( DataSource unpooledDataSource, Map
overrideProps )
public static DataSource pooledDataSource( DataSource unpooledDataSource, Properties
props )
are not processing the passed properties in the same way:
whilst the first method parses the keyvalues as they are,
the latter method peels the keyvalues by removing any "c3p0." prefix:
public static DataSource pooledDataSource( DataSource unpooledDataSource, Properties
props ) throws SQLException
{
//return pooledDataSource( unpooledDataSource, new PoolConfig( props ) );
Properties peeledProps = new Properties();
for (Iterator ii = props.keySet().iterator(); ii.hasNext(); )
{
String propKey = (String) ii.next();
String propVal = props.getProperty( propKey );
String peeledKey = (propKey.startsWith("c3p0.") ? propKey.substring(5)
: propKey );
peeledProps.put( peeledKey, propVal );
}
return pooledDataSource( unpooledDataSource, null, peeledProps );
}
The attached file does fix the problem.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: