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
This commit is contained in:
Milosz Tylenda 2009-05-12 17:43:28 +00:00
parent f221b1fa85
commit 13819e01f7
2 changed files with 4 additions and 5 deletions

View File

@ -57,8 +57,9 @@ public abstract class AbstractJDBCSeq
public Object next(StoreContext ctx, ClassMetaData meta) { public Object next(StoreContext ctx, ClassMetaData meta) {
JDBCStore store = getStore(ctx); JDBCStore store = getStore(ctx);
try { try {
current = nextInternal(store, (ClassMapping) meta); Object currentLocal = nextInternal(store, (ClassMapping) meta);
return current; current = currentLocal;
return currentLocal;
} catch (OpenJPAException ke) { } catch (OpenJPAException ke) {
throw ke; throw ke;
} catch (SQLException se) { } catch (SQLException se) {

View File

@ -296,9 +296,7 @@ public class NativeJDBCSeq
try { try {
stmnt = conn.prepareStatement(_select); stmnt = conn.prepareStatement(_select);
dict.setTimeouts(stmnt, _conf, false); dict.setTimeouts(stmnt, _conf, false);
synchronized(this) { rs = stmnt.executeQuery();
rs = stmnt.executeQuery();
}
if (rs.next()) if (rs.next())
return rs.getLong(1); return rs.getLong(1);