diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java index c4f99c5b9..e2e207fb1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java @@ -157,7 +157,7 @@ public abstract class AbstractJDBCSeq return; try { - if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) + if (type != TYPE_TRANSACTIONAL && type != TYPE_CONTIGUOUS) conn.commit(); } catch (SQLException se) { throw SQLExceptions.getStore(se); diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java index 4613eb777..6af4a9f48 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/TableJDBCSeq.java @@ -230,7 +230,7 @@ public class TableJDBCSeq if (current == null) { Connection conn = getConnection(store); try { - long cur = getSequence(mapping, getConnection(store)); + long cur = getSequence(mapping, conn); if (cur != -1) current = Numbers.valueOf(cur); } finally { @@ -614,10 +614,7 @@ public class TableJDBCSeq catch (NumberFormatException nfe) { return false; } finally { - try { - conn.close(); - } catch (SQLException se) { - } + try { conn.close(); } catch (SQLException se) {} } } else return false;