[ 
https://issues.apache.org/jira/browse/TOMEE-837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13607876#comment-13607876
 ] 

Bertrand Guay-Paquet commented on TOMEE-837:
--------------------------------------------

I'm not 100% sure what that property does. Here's the text from the doc:
"use only all set values in this config will need a lot of properties but allow 
to not set some values"

Does it mean this:
"Use only properties set explicitly in the configuration, ignoring default 
values. Many more properties will need to bet set in the configuration, but 
this allows to leave some properties unset" ?

If so, please use the longer version with punctuation which I believe is much 
more understandable. When would IgnoreDefaultValues be useful? It really looks 
like a "band-aid" type of fix to 

I had a look at the current snapshot of TomEEDataSourceCreator and it seems 
that my main issue is resolved. However, IgnoreDefaultValues is not the reason 
it is fixed because in 1.5.1, setting PoolPreparedStatements to false still 
causes TomEE to use the StatementCache.

Please note that the second problem mentioned in the description regarding 
lines 101 to 112 is NOT fixed.
                
> TomEE DataSource configuration does not honour actual configuration
> -------------------------------------------------------------------
>
>                 Key: TOMEE-837
>                 URL: https://issues.apache.org/jira/browse/TOMEE-837
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: Bertrand Guay-Paquet
>              Labels: configuration, datasource
>
> The Tomcat "StatementCache" jdbc interceptor is always added, no matter what 
> the actual configuration is. Following the TomEE documentation, the following 
> default DataSource property values are added to each created DataSource :
> PoolPreparedStatements=false, MaxOpenPreparedStatements=0
> The method TomEEDataSourceCreator.updateProperties(SuperProperties, 
> Properties, String) at line 138 checks for the presence of the 
> "MaxOpenPreparedStatements" or "PoolPreparedStatements" properties. If they 
> are present, the StatementCache "jdbcInterceptors" property is added to the 
> properties passed on to Tomcat. The test to add the StatementCache is wrong: 
> StatementCache should be added only if PoolPreparedStatements == true and NOT 
> if the "PoolPreparedStatements" property is merely present since it's always 
> the case.
> Also, in the same method between lines 101 and 112, there is unreachable 
> code. Here is the code:
> final String maxWait = toMillis((String) properties.remove("maxWaitTime"));
> if (properties.containsKey("maxWaitTime") && 
> !properties.containsKey("maxWait")) {
>       converted.setProperty("maxWait", maxWait);
> }
> final String tb = toMillis((String) 
> properties.remove("timeBetweenEvictionRuns"));
> if (properties.containsKey("timeBetweenEvictionRuns") && 
> !properties.containsKey("timeBetweenEvictionRunsMillis")) {
>       converted.setProperty("timeBetweenEvictionRunsMillis", tb);
> }
> final String minEvict = toMillis((String) 
> properties.remove("minEvictableIdleTime"));
> if (properties.containsKey("minEvictableIdleTime") && 
> !properties.containsKey("minEvictableIdleTimeMillis")) {
>       converted.setProperty("minEvictableIdleTimeMillis", minEvict);
> }
> In each case, the property is removed and then we check if it's there. This 
> test cannot pass. The first condition of each "if" statement should be of the 
> following form, taken a few lines above in the same file:
> final String user = (String) properties.remove("user");
> if (user != null && !properties.containsKey("username")) {
>       converted.setProperty("username", user);
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to