rzo1 commented on code in PR #144:
URL: https://github.com/apache/openjpa/pull/144#discussion_r3689098373
##########
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/StoredProcedureQuery.java:
##########
@@ -170,23 +172,49 @@ public ResultObjectProvider executeQuery(StoreQuery q,
Object[] params, Range ra
try {
DBDictionary dict = _store.getDBDictionary();
Connection conn = _store.getConnection();
+
+ // PostgreSQL requires auto-commit off for procedures
+ // that return REF_CURSOR (cursor lives within transaction)
+ boolean resetAutoCommit = false;
Review Comment:
Fixed in 88e7709470c1b9e8299c5e51554e127d871b0e94. `resetAutoCommit` is now
handed over to the `XROP` together with the connection (`XROP#setConnection`):
since a REF_CURSOR is only valid inside the transaction that produced it, the
connection stays open while the provider is in use and `XROP#close()` now
commits, restores `autoCommit=true` and closes the connection in a `finally`
after closing the statement. On the error path, `executeQuery` closes the
`CallableStatement`, rolls back, restores `autoCommit` and closes the
connection before rethrowing, so a failing `prepareCall`/`rop.open()` no longer
leaks the connection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]