[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6635?page=c...
]
Guenther Demetz commented on HHH-6635:
--------------------------------------
The diff of org/hibernate/service/jdbc/connections/internal/C3P0ConnectionProvider.java:
168c168
< String newKey = key.substring( 10 );
---
String newKey = key.substring( 15 );
242c242,243
< c3p.put( c3p0StyleKey, String.valueOf( value ).trim() );
---
String peeledC3p0Key = c3p0StyleKey.substring(5);
c3p.put( peeledC3p0Key, String.valueOf( value ).trim() );
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
Attachments: C3P0ConnectionProvider.java
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:
http://www.atlassian.com/software/jira