[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6635) C3P0: hibernate.c3p0.* configuration properties not properly parsed

Strong Liu (JIRA) noreply at atlassian.com
Wed Sep 7 04:12:05 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43469#comment-43469 ] 

Strong Liu commented on HHH-6635:
---------------------------------

Guenther,

would you please also provide a test case?

> 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

        


More information about the hibernate-issues mailing list