From 9dadffffc19228783088509e22c2d42181d02295 Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Mon, 24 Mar 2008 18:41:12 +0000 Subject: [PATCH] OPENJPA-543 git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@640511 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/jdbc/kernel/SQLStoreQuery.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 39894230d..81b2cb2e5 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 @@ -230,15 +230,25 @@ public class SQLStoreQuery if (stmnt != null) buf.setParameters(stmnt); - int count = executeUpdate(store, conn, stmnt, buf); + int count = executeUpdate(store, conn, stmnt, buf); + return Numbers.valueOf(count); } catch (SQLException se) { - if (stmnt != null) - try { stmnt.close(); } catch (SQLException se2) {} - try { conn.close(); } catch (SQLException se2) {} throw SQLExceptions.getStore(se, dict); } finally { - try { conn.close(); } catch (SQLException se) {} + if (stmnt != null) { + try { + stmnt.close(); + } catch (SQLException se) { + // safe to ignore + } finally { + stmnt = null; + } + } + try { + conn.close(); + } catch (SQLException se) { + } } }