openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r832506 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/
Date Tue, 03 Nov 2009 18:50:49 GMT
Author: allee8285
Date: Tue Nov  3 18:50:48 2009
New Revision: 832506

URL: http://svn.apache.org/viewvc?rev=832506&view=rev
Log:
OPENJPA-1306 - Correct secondary table locking problem and test cases to match. Also fixed multiple SQLs validation test case problem.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1x1LockScope.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1xmLockScope.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/TestBasicLockScope.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java?rev=832506&r1=832505&r2=832506&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/MixedLockManager.java Tue Nov  3 18:50:48 2009
@@ -19,9 +19,16 @@
 package org.apache.openjpa.jdbc.kernel;
 
 import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.openjpa.jdbc.meta.ClassMapping;
+import org.apache.openjpa.jdbc.meta.FieldMapping;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.SQLExceptions;
+import org.apache.openjpa.jdbc.sql.SQLFactory;
 import org.apache.openjpa.jdbc.sql.Select;
 import org.apache.openjpa.kernel.MixedLockLevels;
 import org.apache.openjpa.kernel.OpenJPAStateManager;
@@ -74,6 +81,32 @@
         }
     }
 
+    protected List<SQLBuffer> getLockRows(DBDictionary dict, Object id, ClassMapping mapping,
+            JDBCFetchConfiguration fetch, SQLFactory factory) {
+        List<SQLBuffer> sqls = super.getLockRows(dict, id, mapping, fetch, factory);
+        // 
+        if(!dict.supportsLockingWithMultipleTables) {
+            // look for columns mapped to secondary tables which need to be locked
+            Map<String,FieldMapping> colsMappedToSecTable = new HashMap<String,FieldMapping>();
+            FieldMapping fms[] = mapping.getFieldMappings();
+            for( FieldMapping fm : fms) {
+                String secTableName = fm.getMappingInfo().getTableName();
+                if( secTableName != null ) {
+                    colsMappedToSecTable.put(secTableName, fm);
+                }
+            }
+            for( String secTableName : colsMappedToSecTable.keySet()) {
+                FieldMapping fm = colsMappedToSecTable.get(secTableName);
+                // select only the PK columns, since we just want to lock
+                Select select = factory.newSelect();
+                select.select(fm.getColumns());
+                select.whereForeignKey(fm.getJoinForeignKey(), id, mapping, _store);
+                sqls.add(select.toSelect(true, fetch));
+            }
+        }
+        return sqls;
+    }
+
     protected void optimisticLockInternal(OpenJPAStateManager sm, int level,
         int timeout, Object sdata, boolean postLockVersionCheck) {
         super.optimisticLockInternal(sm, level, timeout, sdata,

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java?rev=832506&r1=832505&r2=832506&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java Tue Nov  3 18:50:48 2009
@@ -22,11 +22,14 @@
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.SQLExceptions;
+import org.apache.openjpa.jdbc.sql.SQLFactory;
 import org.apache.openjpa.jdbc.sql.Select;
 import org.apache.openjpa.kernel.OpenJPAStateManager;
 import org.apache.openjpa.kernel.StoreContext;
@@ -48,7 +51,7 @@
     private static final Localizer _loc = Localizer.forPackage
         (PessimisticLockManager.class);
 
-    private JDBCStore _store;
+    protected JDBCStore _store;
 
     public PessimisticLockManager() {
         setVersionCheckOnReadLock(false);
@@ -119,24 +122,20 @@
 
         Object id = sm.getObjectId();
         ClassMapping mapping = (ClassMapping) sm.getMetaData();
-        while (mapping.getJoinablePCSuperclassMapping() != null)
-            mapping = mapping.getJoinablePCSuperclassMapping();
 
-        // select only the PK columns, since we just want to lock
-        Select select = _store.getSQLFactory().newSelect();
-        select.select(mapping.getPrimaryKeyColumns());
-        select.wherePrimaryKey(id, mapping, _store);
-        SQLBuffer sql = select.toSelect(true, fetch);
+        List<SQLBuffer> sqls = getLockRows(dict, id, mapping, fetch, _store.getSQLFactory()); 
 
         ensureStoreManagerTransaction();
         Connection conn = _store.getConnection();
         PreparedStatement stmnt = null;
         ResultSet rs = null;
         try {
-            stmnt = prepareStatement(conn, sql);
-            dict.setTimeouts(stmnt, fetch, true);
-            rs = executeQuery(conn, stmnt, sql);
-            checkLock(rs, sm, timeout);
+            for (SQLBuffer sql : sqls) {
+                stmnt = prepareStatement(conn, sql);
+                dict.setTimeouts(stmnt, fetch, true);
+                rs = executeQuery(conn, stmnt, sql);
+                checkLock(rs, sm, timeout);
+            }
         } catch (SQLException se) {
             throw SQLExceptions.getStoreSQLException(sm, se, dict,
                 level);
@@ -149,6 +148,19 @@
         }
     }
 
+    protected List<SQLBuffer> getLockRows(DBDictionary dict, Object id, ClassMapping mapping,
+            JDBCFetchConfiguration fetch, SQLFactory factory) {
+        while (mapping.getJoinablePCSuperclassMapping() != null)
+            mapping = mapping.getJoinablePCSuperclassMapping();
+        // select only the PK columns, since we just want to lock
+        Select select = factory.newSelect();
+        select.select(mapping.getPrimaryKeyColumns());
+        select.wherePrimaryKey(id, mapping, _store);
+        List<SQLBuffer> sqls = new ArrayList<SQLBuffer>();
+        sqls.add(select.toSelect(true, fetch));
+        return sqls;
+    }
+
     /**
      * Enforce that we have an actual transaction in progress so that we can
      * start locking. The transaction should already be begun when using a

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java?rev=832506&r1=832505&r2=832506&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/LockScopeTestCase.java Tue Nov  3 18:50:48 2009
@@ -66,8 +66,11 @@
  */
 public abstract class LockScopeTestCase extends SQLListenerTestCase {
     
+    protected final String Any              = ".*";
     protected final String Select           = "SELECT.*FROM.*";
     protected final String Where            = ".*WHERE.*";
+//    protected final String Join             = ".*(JOIN){1}.*";
+    protected final String NoJoin           = "(JOIN){0}";
     protected final String ForUpdateRex     = "FOR UPDATE.*";
     protected final String ForUpdateClause  = "(" + ForUpdateRex + ")";
     protected final String ForUpdate        = ForUpdateClause + "{1}";
@@ -149,7 +152,7 @@
             log.trace("\r\n" + toString(sql));
             return;
         }
-        assertAnySQLAnyOrder(expected);
+        assertAllSQLAnyOrder(expected);
     }
     
     protected void logStack(Throwable t) {

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1x1LockScope.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1x1LockScope.java?rev=832506&r1=832505&r2=832506&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1x1LockScope.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1x1LockScope.java Tue Nov  3 18:50:48 2009
@@ -30,6 +30,14 @@
 public class Test1x1LockScope extends LockScopeTestCase {
 
     public void setUp() {
+        setSupportedDatabases(
+                org.apache.openjpa.jdbc.sql.DerbyDictionary.class,
+                org.apache.openjpa.jdbc.sql.OracleDictionary.class,
+                org.apache.openjpa.jdbc.sql.DB2Dictionary.class);
+        if (isTestsDisabled()) {
+            return;
+        }
+
         setUp(LSE1x1Lf.class
             , LSE1x1LfLzy.class
             , LSE1x1LfJT.class
@@ -113,7 +121,7 @@
                             // SELECT t0.version, t0.firstName, t1.id, t1.version, t1.lastName 
                             //      FROM LSE1x1Lf t0, LSE1x1Rt t1 WHERE t0.id = ? AND t0.UNIRIGHT_ID = t1.id(+) 
                             //      [params=(int) 1111201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableRtName + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + tableLfName + Any + tableRtName + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:
@@ -143,7 +151,7 @@
                             //      FOR UPDATE [params=(int) 1111202]
                             // SELECT t0.version FROM LSE1x1Rt t0 WHERE t0.id = ? FOR UPDATE [params=(int) 1121202]
                             // SELECT t0.version FROM LSE1x1Lf t0 WHERE t0.id = ? FOR UPDATE [params=(int) 1111202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableRtName + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + tableLfName + Any + tableRtName + Where + "\\(\\+\\).*"
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock.
@@ -158,8 +166,8 @@
                             // SELECT t0.id FROM LSE1x1Lf t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1111202]
                             // SELECT t0.version FROM LSE1x1Lf t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1111202]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + ".*" + Where + ForUpdate,
-                                    Select + tableRtName + ".*" + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -185,7 +193,7 @@
                             //      FOR UPDATE [params=(String) firstName%1111201]
                             // SELECT t0.version FROM LSE1x1Rt t0 WHERE t0.id = ? [params=(int) 1121201]
                             // SELECT t0.version FROM LSE1x1Lf t0 WHERE t0.id = ? [params=(int) 1111201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableRtName + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + tableLfName + Any + tableRtName + Where + "\\(\\+\\).*"
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock.
@@ -200,8 +208,8 @@
                             // SELECT t0.id FROM LSE1x1Lf t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1111201]
                             // SELECT t0.version FROM LSE1x1Lf t0 WHERE t0.id = ? [params=(int) 1111201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + ".*" + Where + ForUpdate,
-                                    Select + tableRtName + ".*" + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -221,7 +229,7 @@
                             // SELECT t0.version, t0.firstName, t1.id, t1.version, t1.lastName 
                             //      FROM LSE1x1Lf t0, LSE1x1Rt t1 WHERE t0.id = ? AND t0.UNIRIGHT_ID = t1.id(+) 
                             //      [params=(int) 1111202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableRtName + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + tableLfName + Any + tableRtName + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:
@@ -251,7 +259,7 @@
                             //      FOR UPDATE [params=(String) firstName%1111201]
                             // SELECT t0.version FROM LSE1x1Rt t0 WHERE t0.id = ? [params=(int) 1121201]
                             // SELECT t0.version FROM LSE1x1Lf t0 WHERE t0.id = ? [params=(int) 1111201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableRtName + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + tableLfName + Any + tableRtName + Where + "\\(\\+\\).*"
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock.
@@ -266,8 +274,8 @@
                             // SELECT t0.id FROM LSE1x1Lf t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1111201]
                             // SELECT t0.version FROM LSE1x1Lf t0 WHERE t0.id = ? [params=(int) 1111201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + ".*" + Where + ForUpdate,
-                                    Select + tableRtName + ".*" + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -287,7 +295,7 @@
                             // SELECT t0.version, t0.firstName, t1.id, t1.version, t1.lastName 
                             //      FROM LSE1x1Lf t0, LSE1x1Rt t1 WHERE t0.id = ? AND t0.UNIRIGHT_ID = t1.id(+) 
                             //      [params=(int) 1111202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableRtName + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + tableLfName + Any + tableRtName + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:
@@ -552,7 +560,7 @@
                             //      FROM LSE1x1LfJT t0, Uni1x1LfJT_Uni1x1RT t1, LSE1x1Rt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1X1LFJT_ID AND t1.UNIRIGHTJT_ID = t2.id(+) 
                             //      [params=(int) 1112201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -583,7 +591,7 @@
                             //      FOR UPDATE [params=(int) 1112202]
                             // SELECT t0.version FROM LSE1x1Rt t0 WHERE t0.id = ? FOR UPDATE [params=(int) 1122202]
                             // SELECT t0.version FROM LSE1x1LfJT t0 WHERE t0.id = ? FOR UPDATE [params=(int) 1112202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock, if jpa2/extended scope, LOCK Uni1x1LfJT_Uni1x1RT
@@ -600,8 +608,8 @@
                             // SELECT t0.id FROM LSE1x1LfJT t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1112202]
                             // SELECT t0.version FROM LSE1x1LfJT t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1112202]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + ".*" + Where + ForUpdate,
-                                    Select + tableRtName + ".*" + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -628,7 +636,7 @@
                             //      AND t1.UNIRIGHTJT_ID = t2.id(+) FOR UPDATE [params=(String) firstName%1112201]
                             // SELECT t0.version FROM LSE1x1Rt t0 WHERE t0.id = ? [params=(int) 1122201]
                             // SELECT t0.version FROM LSE1x1LfJT t0 WHERE t0.id = ? [params=(int) 1112201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock, if jpa2/extended scope, LOCK Uni1x1LfJT_Uni1x1RT
@@ -645,8 +653,8 @@
                             // SELECT t0.id FROM LSE1x1LfJT t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1112201]
                             // SELECT t0.version FROM LSE1x1LfJT t0 WHERE t0.id = ? [params=(int) 1112201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + ".*" + Where + ForUpdate,
-                                    Select + tableRtName + ".*" + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -668,7 +676,7 @@
                             //      FROM LSE1x1LfJT t0, Uni1x1LfJT_Uni1x1RT t1, LSE1x1Rt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1X1LFJT_ID AND t1.UNIRIGHTJT_ID = t2.id(+) 
                             //      [params=(int) 1112202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -700,7 +708,7 @@
                             //      AND t1.UNIRIGHTJT_ID = t2.id(+) FOR UPDATE [params=(String) firstName%1112201]
                             // SELECT t0.version FROM LSE1x1Rt t0 WHERE t0.id = ? [params=(int) 1122201]
                             // SELECT t0.version FROM LSE1x1LfJT t0 WHERE t0.id = ? [params=(int) 1112201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock, if jpa2/extended scope, LOCK Uni1x1LfJT_Uni1x1RT
@@ -717,8 +725,8 @@
                             // SELECT t0.id FROM LSE1x1LfJT t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 1112201]
                             // SELECT t0.version FROM LSE1x1LfJT t0 WHERE t0.id = ? [params=(int) 1112201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + ".*" + Where + ForUpdate,
-                                    Select + tableRtName + ".*" + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -740,7 +748,7 @@
                             //      FROM LSE1x1LfJT t0, Uni1x1LfJT_Uni1x1RT t1, LSE1x1Rt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1X1LFJT_ID AND t1.UNIRIGHTJT_ID = t2.id(+) 
                             //      [params=(int) 1112202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1xmLockScope.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1xmLockScope.java?rev=832506&r1=832505&r2=832506&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1xmLockScope.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/Test1xmLockScope.java Tue Nov  3 18:50:48 2009
@@ -30,6 +30,14 @@
 public class Test1xmLockScope extends LockScopeTestCase {
 
     public void setUp() {
+        setSupportedDatabases(
+                org.apache.openjpa.jdbc.sql.DerbyDictionary.class,
+                org.apache.openjpa.jdbc.sql.OracleDictionary.class,
+                org.apache.openjpa.jdbc.sql.DB2Dictionary.class);
+        if (isTestsDisabled()) {
+            return;
+        }
+
         setUp(LSE1xmLf.class
             , LSE1xmLfEgr.class
             , LSE1xmLfJT.class
@@ -316,7 +324,7 @@
                             //      FROM LSE1xmLfEgr t0, LSE1xmLfEgr_LSE1xmRt t1, LSE1xmRt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1XMLFEGR_ID(+) AND t1.UNIRIGHT_ID = t2.id(+) 
                             //      [params=(int) 2111201] 
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -353,7 +361,7 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? FOR UPDATE [params=(int) 2121203]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? FOR UPDATE [params=(int) 2121204]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ? FOR UPDATE [params=(int) 2111202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock. If jpa2, DO NOT lock LSE1xmRt, 
@@ -378,9 +386,9 @@
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ? FOR UPDATE WITH RR
                             //      [params=(int) 2111202]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -410,10 +418,10 @@
                             //      FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 2121202]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ?  [params=(int) 2121202]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ?  [params=(int) 2111201]
-                            assertLockTestSQLs(Select + tableLfName + Where + DB2Lock,
+                            assertLockTestSQLs(Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + DB2Lock,
                                     Select + joinTables + Where + NoDB2Lock,
-                                    Select + tableRtName + Where + DB2Lock,
-                                    Select + tableRtName + Where + DB2Lock);
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock);
                             break;
                         case oracle:    // TODO: if jpa2, DO NOT lock LSE1xmRT using "FOR UPDATE OF col"
                             // SELECT t0.id, t0.version, t0.firstName FROM LSE1xmLfEgr t0 WHERE (t0.firstName LIKE ?) 
@@ -425,8 +433,8 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2121202]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2121201]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ? [params=(int) 2111201]
-                            assertLockTestSQLs(Select + tableLfName + Where + ForUpdate,
-                                    Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock. If jpa2, DO NOT lock LSE1xmRt, 
@@ -448,9 +456,9 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2121201]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ? [params=(int) 2111201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate
+                                    Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -472,7 +480,7 @@
                             //      FROM LSE1xmLfEgr t0, LSE1xmLfEgr_LSE1xmRt t1, LSE1xmRt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1XMLFEGR_ID(+) AND t1.UNIRIGHT_ID = t2.id(+) 
                             //      [params=(int) 2111202] 
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -507,10 +515,10 @@
                             //      FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 2121202]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ?  [params=(int) 2121202]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ?  [params=(int) 2111201]
-                            assertLockTestSQLs(Select + tableLfName + Where + DB2Lock,
+                            assertLockTestSQLs(Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + DB2Lock,
                                     Select + joinTables + Where + NoDB2Lock,
-                                    Select + tableRtName + Where + DB2Lock,
-                                    Select + tableRtName + Where + DB2Lock);
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock);
                             break;
                         case oracle:    // TODO: if jpa2, DO NOT lock LSE1xmRT using "FOR UPDATE OF col"
                             // SELECT t0.id, t0.version, t0.firstName FROM LSE1xmLfEgr t0 WHERE (t0.firstName LIKE ?) 
@@ -522,8 +530,8 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2121202]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2121201]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ? [params=(int) 2111201]
-                            assertLockTestSQLs(Select + tableLfName + Where + ForUpdate,
-                                    Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock. If jpa2, DO NOT lock LSE1xmRt, 
@@ -545,9 +553,9 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2121201]
                             // SELECT t0.version FROM LSE1xmLfEgr t0 WHERE t0.id = ? [params=(int) 2111201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate
+                                    Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -569,7 +577,7 @@
                             //      FROM LSE1xmLfEgr t0, LSE1xmLfEgr_LSE1xmRt t1, LSE1xmRt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1XMLFEGR_ID(+) AND t1.UNIRIGHT_ID = t2.id(+) 
                             //      [params=(int) 2111202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -854,7 +862,7 @@
                             //      FROM LSE1xmLfJTEgr t0, LSE1xmLfJTEgr_LSE1xmRt t1, LSE1xmRt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1XMLFJTEGR_ID(+) AND t1.UNIRIGHT_ID = t2.id(+) 
                             //      [params=(int) 2112201]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -891,7 +899,7 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? FOR UPDATE [params=(int) 2122203]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? FOR UPDATE [params=(int) 2122204]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ? FOR UPDATE [params=(int) 2112202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock. If jpa2, DO NOT lock LSE1xmRt, 
@@ -916,9 +924,9 @@
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ? FOR UPDATE WITH RR
                             //      [params=(int) 2112202]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate
+                                    Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -948,10 +956,10 @@
                             //      FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 2122202]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ?  [params=(int) 2122202]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ?  [params=(int) 2112201]
-                            assertLockTestSQLs(Select + tableLfName + Where + DB2Lock,
+                            assertLockTestSQLs(Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + DB2Lock,
                                     Select + joinTables + Where + NoDB2Lock,
-                                    Select + tableRtName + Where + DB2Lock,
-                                    Select + tableRtName + Where + DB2Lock);
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock);
                             break;
                         case oracle:    // TODO: if jpa2, DO NOT lock LSE1xmRT using "FOR UPDATE OF col"
                             // SELECT t0.id, t0.version, t0.firstName FROM LSE1xmLfJTEgr t0 WHERE (t0.firstName LIKE ?) 
@@ -964,8 +972,8 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2122201]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2122202]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ? [params=(int) 2112201]
-                            assertLockTestSQLs(Select + tableLfName + Where + ForUpdate,
-                                    Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock. If jpa2, DO NOT lock LSE1xmRt, 
@@ -987,9 +995,9 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2122201]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ? [params=(int) 2112201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate
+                                    Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -1011,7 +1019,7 @@
                             //      FROM LSE1xmLfJTEgr t0, LSE1xmLfJTEgr_LSE1xmRt t1, LSE1xmRt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1XMLFJTEGR_ID(+) AND t1.UNIRIGHT_ID = t2.id(+) 
                             //      [params=(int) 2112202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:
@@ -1046,10 +1054,10 @@
                             //      FOR READ ONLY WITH RS USE AND KEEP UPDATE LOCKS [params=(int) 2122202]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ?  [params=(int) 2122202]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ?  [params=(int) 2112201]
-                            assertLockTestSQLs(Select + tableLfName + Where + DB2Lock,
+                            assertLockTestSQLs(Select + NoJoin + Any + tableLfName + Any + NoJoin + Where + DB2Lock,
                                     Select + joinTables + Where + NoDB2Lock,
-                                    Select + tableRtName + Where + DB2Lock,
-                                    Select + tableRtName + Where + DB2Lock);
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock,
+                                    Select + NoJoin + Any + tableRtName + Any + NoJoin + Where + DB2Lock);
                             break;
                         case oracle:    // TODO: if jpa2, DO NOT lock LSE1xmRT using "FOR UPDATE OF col"
                             // SELECT t0.id, t0.version, t0.firstName FROM LSE1xmLfJTEgr t0 WHERE (t0.firstName LIKE ?) 
@@ -1062,8 +1070,8 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2122201]
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2122202]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ? [params=(int) 2112201]
-                            assertLockTestSQLs(Select + tableLfName + Where + ForUpdate,
-                                    Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + NoJoin + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock. If jpa2, DO NOT lock LSE1xmRt, 
@@ -1085,9 +1093,9 @@
                             // SELECT t0.version FROM LSE1xmRt t0 WHERE t0.id = ? [params=(int) 2122201]
                             // SELECT t0.version FROM LSE1xmLfJTEgr t0 WHERE t0.id = ? [params=(int) 2112201]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + tableLfName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate,
-                                    Select + tableRtName + Where + ForUpdate
+                                    Select + tableLfName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + tableRtName + NoJoin + Where + ForUpdate
                                     );
                             break;
                         default:
@@ -1109,7 +1117,7 @@
                             //      FROM LSE1xmLfJTEgr t0, LSE1xmLfJTEgr_LSE1xmRt t1, LSE1xmRt t2 
                             //      WHERE t0.id = ? AND t0.id = t1.LSE1XMLFJTEGR_ID(+) AND t1.UNIRIGHT_ID = t2.id(+) 
                             //      [params=(int) 2112202]
-                            assertLockTestSQLs(Select + tableLfName + ".*" + tableJTName + ".*" + tableRtName + Where
+                            assertLockTestSQLs(Select + tableLfName + Any + tableJTName + Any + tableRtName + Where
                                     + "\\(\\+\\).*" + NoForUpdate);
                             break;
                         case derby:

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/TestBasicLockScope.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/TestBasicLockScope.java?rev=832506&r1=832505&r2=832506&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/TestBasicLockScope.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lock/extended/TestBasicLockScope.java Tue Nov  3 18:50:48 2009
@@ -32,6 +32,14 @@
 public class TestBasicLockScope extends LockScopeTestCase {
 
     public void setUp() {
+        setSupportedDatabases(
+                org.apache.openjpa.jdbc.sql.DerbyDictionary.class,
+                org.apache.openjpa.jdbc.sql.OracleDictionary.class,
+                org.apache.openjpa.jdbc.sql.DB2Dictionary.class);
+        if (isTestsDisabled()) {
+            return;
+        }
+
         setUp(LSEBase.class
             , LSESecTbl.class
             , LSESngTblCon.class
@@ -269,7 +277,7 @@
                         case oracle:
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0, LSESecTblDtl t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSESECTBL_ID [params=(int) 100]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + NoForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + NoForUpdate);
                             break;
                         case derby:
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0
@@ -294,9 +302,9 @@
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0, LSESecTblDtl t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSESECTBL_ID FOR UPDATE [params=(int) 101]
                             // SELECT t0.version FROM LSESecTbl t0 WHERE t0.id = ? FOR UPDATE [params=(int) 101]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
-                        case derby:     //TODO: **Non-atomic lock, SecTblDtl NOT locked *********
+                        case derby:
                             // The database is unable to lock this query.  Each object matching the query will be 
                             //  locked individually after it is loaded; however, it is technically possible that
                             //  another transaction could modify the data before the lock is obtained.
@@ -304,9 +312,11 @@
                             //      INNER JOIN LSESecTblDtl t1 ON t0.id = t1.LSESECTBL_ID WHERE t0.id = ?
                             //      [params=(int) 101]
                             // SELECT t0.id FROM LSESecTbl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 101]
+                            // SELECT t0.id FROM LSESecTblDtl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 101]
                             // SELECT t0.version FROM LSESecTbl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 101]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table1Name + ".*" + Where + ForUpdate);
+                                    Select + NoJoin + Any + table1Name + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + table2Name + Any + NoJoin + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -328,9 +338,9 @@
                             //      WHERE (t0.firstName LIKE ?) AND t0.id = t1.LSESECTBL_ID FOR UPDATE 
                             //      [params=(String) firstName%100]
                             // SELECT t0.version FROM LSESecTbl t0 WHERE t0.id = ? [params=(int) 100]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
-                        case derby:     //TODO: **Non-atomic lock, SecTblDtl NOT locked *********
+                        case derby:
                             // The database is unable to lock this query.  Each object matching the query will be 
                             //  locked individually after it is loaded; however, it is technically possible that
                             //  another transaction could modify the data before the lock is obtained.
@@ -338,9 +348,11 @@
                             //      INNER JOIN LSESecTblDtl t1 ON t0.id = t1.LSESECTBL_ID 
                             //      WHERE (t0.firstName LIKE ? ESCAPE '\') [params=(String) firstName%100]
                             // SELECT t0.id FROM LSESecTbl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 100]
+                            // SELECT t0.id FROM LSESecTblDtl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 100]
                             // SELECT t0.version FROM LSESecTbl t0 WHERE t0.id = ? [params=(int) 100]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table1Name + ".*" + Where + ForUpdate);
+                                    Select + NoJoin + Any + table1Name + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + table2Name + Any + NoJoin + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -358,7 +370,7 @@
                         case oracle:
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0, LSESecTblDtl t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSESECTBL_ID [params=(int) 101]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + NoForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + NoForUpdate);
                             break;
                         case derby:
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0
@@ -384,9 +396,9 @@
                             //      WHERE (t0.firstName LIKE ?) AND t0.id = t1.LSESECTBL_ID FOR UPDATE 
                             //      [params=(String) firstName%100]
                             // SELECT t0.version FROM LSESecTbl t0 WHERE t0.id = ? [params=(int) 100]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
-                        case derby:     //TODO: **Non-atomic lock, SecTblDtl NOT locked *********
+                        case derby:
                             // The database is unable to lock this query.  Each object matching the query will be 
                             //  locked individually after it is loaded; however, it is technically possible that
                             //  another transaction could modify the data before the lock is obtained.
@@ -394,9 +406,11 @@
                             //      INNER JOIN LSESecTblDtl t1 ON t0.id = t1.LSESECTBL_ID
                             //      WHERE (t0.firstName LIKE ? ESCAPE '\') [params=(String) firstName%100]
                             // SELECT t0.id FROM LSESecTbl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 100]
+                            // SELECT t0.id FROM LSESecTblDtl t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 100]
                             // SELECT t0.version FROM LSESecTbl t0 WHERE t0.id = ? [params=(int) 100]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table1Name + ".*" + Where + ForUpdate);
+                                    Select + NoJoin + Any + table1Name + Any + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + table2Name + Any + NoJoin + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -414,7 +428,7 @@
                         case oracle:
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0, LSESecTblDtl t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSESECTBL_ID [params=(int) 101]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + NoForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + NoForUpdate);
                             break;
                         case derby:
                             // SELECT t0.version, t0.firstName, t1.lastName FROM LSESecTbl t0
@@ -659,7 +673,7 @@
                         case oracle:
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0, LSEJoinAbs t1 
                             //      WHERE t0.id = ? AND t0.id = t1.id [params=(int) 400]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + NoForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + NoForUpdate);
                             break;
                         case derby:
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0
@@ -683,7 +697,7 @@
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0, LSEJoinAbs t1 
                             //      WHERE t0.id = ? AND t0.id = t1.id FOR UPDATE [params=(int) 401]
                             // SELECT t0.version FROM LSEJoinAbs t0 WHERE t0.id = ? FOR UPDATE [params=(int) 401]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock, LSEJoinCon NOT locked *********
                             // The database is unable to lock this query.  Each object matching the query will be 
@@ -695,7 +709,8 @@
                             // SELECT t0.version FROM LSEJoinAbs t0 WHERE t0.id = ? FOR UPDATE WITH RR
                             //      [params=(int) 401]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table2Name + ".*" + Where + ForUpdate);
+                                    // Select + NoJoin + table1Name + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + table2Name + Any + NoJoin + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -717,7 +732,7 @@
                             //      FROM LSEJoinCon t0, LSEJoinAbs t1 WHERE (t1.firstName LIKE ?) AND t0.id = t1.id 
                             //      FOR UPDATE [params=(String) firstName%400]
                             // SELECT t0.version FROM LSEJoinAbs t0 WHERE t0.id = ? [params=(int) 400]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock, LSEJoinCon NOT locked *********
                             // The database is unable to lock this query.  Each object matching the query will be 
@@ -729,7 +744,8 @@
                             // SELECT t0.id FROM LSEJoinAbs t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 400]
                             // SELECT t0.version FROM LSEJoinAbs t0 WHERE t0.id = ? [params=(int) 400]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table2Name + ".*" + Where + ForUpdate);
+                                    // Select + NoJoin + table1Name + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + table2Name + Any + NoJoin + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -747,7 +763,7 @@
                         case oracle:
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0, LSEJoinAbs t1 
                             //      WHERE t0.id = ? AND t0.id = t1.id [params=(int) 401]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + NoForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + NoForUpdate);
                             break;
                         case derby:
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0
@@ -772,7 +788,7 @@
                             //      FROM LSEJoinCon t0, LSEJoinAbs t1 WHERE (t1.firstName LIKE ?) AND t0.id = t1.id 
                             //      FOR UPDATE [params=(String) firstName%400]
                             // SELECT t0.version FROM LSEJoinAbs t0 WHERE t0.id = ? [params=(int) 400]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
                         case derby:     //TODO: **Non-atomic lock, LSEJoinCon NOT locked *********
                             // The database is unable to lock this query.  Each object matching the query will be 
@@ -784,7 +800,8 @@
                             // SELECT t0.id FROM LSEJoinAbs t0 WHERE t0.id = ? FOR UPDATE WITH RR [params=(int) 400]
                             // SELECT t0.version FROM LSEJoinAbs t0 WHERE t0.id = ? [params=(int) 400]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table2Name + ".*" + Where + ForUpdate);
+                                    // Select + NoJoin + table1Name + NoJoin + Where + ForUpdate,
+                                    Select + NoJoin + Any + table2Name + Any + NoJoin + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -802,7 +819,7 @@
                         case oracle:
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0, LSEJoinAbs t1 
                             //      WHERE t0.id = ? AND t0.id = t1.id [params=(int) 401]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + NoForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + NoForUpdate);
                             break;
                         case derby:
                             // SELECT t0.id, t1.version, t1.firstName, t0.lastName FROM LSEJoinCon t0
@@ -1036,7 +1053,7 @@
                             // SELECT t0.version, t0.firstName, t1.LSEELECOLEGR_ID, t1.element 
                             //      FROM LSEEleColEgr t0, LSEEleColEgr_collection t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSEELECOLEGR_ID(+) [params=(int) 600]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:
@@ -1063,7 +1080,7 @@
                             //      FROM LSEEleColEgr t0, LSEEleColEgr_collection t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSEELECOLEGR_ID(+) FOR UPDATE [params=(int) 601]
                             // SELECT t0.version FROM LSEEleColEgr t0 WHERE t0.id = ? FOR UPDATE [params=(int) 601]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:     // **Non-atomic lock, No need to lock LSEEleColEgr_collection *********
@@ -1079,7 +1096,7 @@
                             // SELECT t0.version FROM LSEEleColEgr t0 WHERE t0.id = ? FOR UPDATE WITH RR
                             //      [params=(int) 601]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate, 
-                                    Select + table1Name + ".*" + Where + ForUpdate);
+                                    Select + table1Name + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -1109,7 +1126,7 @@
                             //      WHERE (t0.firstName LIKE ?) AND t0.id = t1.LSEELECOLEGR_ID ORDER BY t0.id ASC 
                             //      FOR UPDATE [params=(String) firstName%600]
                             // SELECT t0.version FROM LSEEleColEgr t0 WHERE t0.id = ? [params=(int) 600]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
                         case derby:     //**Non-atomic lock, No need to lock LSEEleColEgr_Collection *********
                             // The database is unable to lock this query.  Each object matching the query will be 
@@ -1122,7 +1139,7 @@
                             //      ORDER BY t0.id ASC [params=(String) firstName%600]
                             // SELECT t0.version FROM LSEEleColEgr t0 WHERE t0.id = ? [params=(int) 600]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate,
-                                    Select + table1Name + ".*" + Where + ForUpdate);
+                                    Select + table1Name + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -1135,14 +1152,13 @@
                             // SELECT t0.version, t0.firstName, t1.LSEELECOLEGR_ID, t1.element FROM LSEEleColEgr t0
                             //      LEFT OUTER JOIN LSEEleColEgr_collection t1 ON t0.id = t1.LSEELECOLEGR_ID
                             //      WHERE t0.id = ?  [params=(int) 601]
-                            assertLockTestSQLs(Select + "LSEEleColEgr.*" + Where + DB2Lock,
-                                    Select + joinTables + Where + NoDB2Lock);
+                            assertLockTestSQLs(Select + joinTables + Where + NoDB2Lock);
                             break;
                         case oracle:
                             // SELECT t0.version, t0.firstName, t1.LSEELECOLEGR_ID, t1.element 
                             //      FROM LSEEleColEgr t0, LSEEleColEgr_collection t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSEELECOLEGR_ID(+) [params=(int) 601]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:
@@ -1177,7 +1193,7 @@
                             //      WHERE (t0.firstName LIKE ?) AND t0.id = t1.LSEELECOLEGR_ID ORDER BY t0.id ASC 
                             //      FOR UPDATE [params=(String) firstName%600]
                             // SELECT t0.version FROM LSEEleColEgr t0 WHERE t0.id = ? [params=(int) 600]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + ForUpdate);
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + ForUpdate);
                             break;
                         case derby:     // **Non-atomic lock, No need to lock LSEEleColEgr_collection *********   
                             // The database is unable to lock this query.  Each object matching the query will be 
@@ -1190,7 +1206,7 @@
                             //      ORDER BY t0.id ASC [params=(String) firstName%600]
                             // SELECT t0.version FROM LSEEleColEgr t0 WHERE t0.id = ? [params=(int) 600]
                             assertLockTestSQLs(Select + joinTables + Where + NoForUpdate, 
-                                    Select + table1Name + ".*" + Where + ForUpdate);
+                                    Select + table1Name + Where + ForUpdate);
                             break;
                         default:
                             assertLockTestSQLs(Select + joinTables + Where + ForUpdate);
@@ -1209,7 +1225,7 @@
                             // SELECT t0.version, t0.firstName, t1.LSEELECOLEGR_ID, t1.element 
                             //      FROM LSEEleColEgr t0, LSEEleColEgr_collection t1 
                             //      WHERE t0.id = ? AND t0.id = t1.LSEELECOLEGR_ID(+) [params=(int) 601]
-                            assertLockTestSQLs(Select + table1Name + ".*" + table2Name + Where + "\\(\\+\\).*"
+                            assertLockTestSQLs(Select + table1Name + Any + table2Name + Where + "\\(\\+\\).*"
                                     + NoForUpdate);
                             break;
                         case derby:



Mime
View raw message