From fab1a92046f60999aa6428f2f27a9fdf1056bba4 Mon Sep 17 00:00:00 2001 From: Catalina Wei Date: Mon, 1 Oct 2007 21:50:15 +0000 Subject: [PATCH] OPENJPA-389 et.commit() not issuing database commit for Native queries involving updates. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@581088 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java index c2d5805f4..b444495a2 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SQLStoreQuery.java @@ -215,6 +215,9 @@ public class SQLStoreQuery paramList = Collections.EMPTY_LIST; SQLBuffer buf = new SQLBuffer(dict).append(sql); + + // we need to make sure we have an active store connection + store.getContext().beginStore(); Connection conn = store.getConnection(); JDBCFetchConfiguration fetch = (JDBCFetchConfiguration) q.getContext().getFetchConfiguration(); @@ -241,6 +244,8 @@ public class SQLStoreQuery try { stmnt.close(); } catch (SQLException se2) {} try { conn.close(); } catch (SQLException se2) {} throw SQLExceptions.getStore(se, dict); + } finally { + try { conn.close(); } catch (SQLException se) {} } }