You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Mark Struberg (Jira)" <ji...@apache.org> on 2021/04/07 05:49:00 UTC
[jira] [Assigned] (OPENJPA-2789) JDBC connection not closed when
running named query in explicitly opened connection
[ https://issues.apache.org/jira/browse/OPENJPA-2789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg reassigned OPENJPA-2789:
--------------------------------------
Assignee: Mark Struberg
> JDBC connection not closed when running named query in explicitly opened connection
> -----------------------------------------------------------------------------------
>
> Key: OPENJPA-2789
> URL: https://issues.apache.org/jira/browse/OPENJPA-2789
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc, kernel
> Affects Versions: 2.4.3
> Environment: Windows 7, Java 8 64 Bit, openJPA 2.4.3, maven 3.6.1
> Reporter: Wolfgang Rupprath
> Assignee: Mark Struberg
> Priority: Critical
> Attachments: jpa243bug.zip
>
>
> When executing a named query against a database within an explicitly opened transaction, after 10 successful executions the program hangs.
> The problem occured when we started migrating from openJPA 2.2.0 to 2.4.3
> I have tested against DB2 and Oracle databases with the same results. I suspect the problem arises for any relational DB.
> I have attached a simple maven project that will demonstrate the bug.
> Under 2.2.0, the test runs fine.
> When the query is changed to a native query, the test runs fine.
> Debugging the openJPA code, I found suspicious code in class org.apache.openjpa.jdbc.kernel.JDBCStoreQuery, method executeBulkOperation, line 587:
> try {
> {{ if (conn.getAutoCommit())}}
> conn.close();
> {{ } catch (SQLException se) {}}{{}}}{{}}
> The connection in case will not be returned to the pool as the conn.close() is not executed wthin a transaction. So when committing, the ref count will not be zero when the transaction ends and the underlying JDBC connection will not be closed.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)