From 13819e01f7d57a59ebc945e4bd33b4b4882863bf Mon Sep 17 00:00:00 2001 From: Milosz Tylenda Date: Tue, 12 May 2009 17:43:28 +0000 Subject: [PATCH] OPENJPA-466: Get rid of possible duplicate sequence values git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@773999 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java | 5 +++-- .../java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) 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 f2c3c6520..e3da56391 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 @@ -57,8 +57,9 @@ public abstract class AbstractJDBCSeq public Object next(StoreContext ctx, ClassMetaData meta) { JDBCStore store = getStore(ctx); try { - current = nextInternal(store, (ClassMapping) meta); - return current; + Object currentLocal = nextInternal(store, (ClassMapping) meta); + current = currentLocal; + return currentLocal; } catch (OpenJPAException ke) { throw ke; } catch (SQLException se) { diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java index ac0e62aed..5c1d13465 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/NativeJDBCSeq.java @@ -296,9 +296,7 @@ public class NativeJDBCSeq try { stmnt = conn.prepareStatement(_select); dict.setTimeouts(stmnt, _conf, false); - synchronized(this) { - rs = stmnt.executeQuery(); - } + rs = stmnt.executeQuery(); if (rs.next()) return rs.getLong(1);