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

Kevin Sutter commented on OPENJPA-2312:
---------------------------------------

You did some good evaluation, but I think your issue is elsewhere...  The 
setting of supportsMultipleNontransactionalResultSets to true is the default 
for most of the databases that OpenJPA supports.  From our documentation [1], 
here's what this property is used for:

SupportsMultipleNontransactionalResultSets: When true, a nontransactional 
connection is capable of having multiple open ResultSet instances.

So, although this setting is controlling the setting of autocommit in your 
case, I think the real conditional is the one just previous to this where the 
connection factory is determined to be managed or not...  It looks like in your 
scenario that the ConnectionFactory mode is *not* managed.  In that case, then 
OpenJPA looks at the MultipleNontransactionalResultSets setting to see how auto 
commit should be set.  Based on the description of your scenario, I would have 
assumed that you wanted to run in a managed mode.

            if (factory2 || !conf.isConnectionFactoryModeManaged()) {
                if (!dict.supportsMultipleNontransactionalResultSets)
                    ccd.setAutoCommit(Boolean.FALSE);
                else
                    ccd.setAutoCommit(Boolean.TRUE);

>From the javadoc...
o  boolean 
org.apache.openjpa.conf.OpenJPAConfiguration.isConnectionFactoryModeManaged()
Whether connections are automatically enlisted in global transactions.

So, I would look into how OpenJPA is configured with Spring.  Somehow, it looks 
like OpenJPA is not running in a managed mode and, thus, the use of 
transactions to control the flow of connection interactions is not happening.  
Maybe more tracing from both Spring and OpenJPA would help narrow down the 
issue.

[1]  
http://openjpa.apache.org/builds/latest/docs/docbook/manual.html#ref_guide_dbsetup_dbdictprops
                
> H2 is forced to autoCommit; breaks transactions
> -----------------------------------------------
>
>                 Key: OPENJPA-2312
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2312
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Gustavo Lopes
>         Attachments: details.txt
>
>
> DataSourceFactory::installDBDictionary() sets autocommit to TRUE on the 
> ConfiguringConnectionDecorator because 
> supportsMultipleNontransactionalResultSets is true.

--
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