Author: wisneskid
Date: Wed Apr 18 14:26:20 2007
New Revision: 530163

URL: http://svn.apache.org/viewvc?view=rev&rev=530163
Log:
 fix for OPENJPA-222 .Update the getForUpdateClause, instead of overriding the 
toSelect

Modified:
    
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java

Modified: 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: 
http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?view=diff&rev=530163&r1=530162&r2=530163
==============================================================================
--- 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
 (original)
+++ 
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
 Wed Apr 18 14:26:20 2007
@@ -245,11 +245,7 @@
             else
                 isolationLevel = conf.getTransactionIsolationConstant();
 
-            if (!forUpdate) {
-                // This sql is not for update so add FOR Read Only clause
-                forUpdateString.append(" ").append(forReadOnlyClause)
-                    .append(" ");
-            } else {
+            if (forUpdate) {
 
                 switch(db2ServerType) {
                 case db2ISeriesV5R3AndEarlier:
@@ -266,22 +262,26 @@
                 case db2ZOSV8x:
                 case db2UDBV82AndLater:
                     if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) 
{
-                        forUpdateString.append(" ").append(withRRClause)
+                        forUpdateString.append(" ").append(forReadOnlyClause)
+                            .append(" ").append(withRRClause)
                             .append(" ").append(useKeepUpdateLockClause)
                             .append(" ");
                     } else {
-                        forUpdateString.append(" ").append(withRSClause)
+                        forUpdateString.append(" ").append(forReadOnlyClause)
+                            .append(" ").append(withRSClause)
                             .append(" ").append(useKeepUpdateLockClause)
                             .append(" ");
                     }
                     break;
                 case db2ISeriesV5R4AndLater:
                     if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) 
{
-                        forUpdateString.append(" ").append(withRRClause)
+                        forUpdateString.append(" ").append(forReadOnlyClause)
+                            .append(" ").append(withRRClause)
                             .append(" ").append(useKeepExclusiveLockClause)
                             .append(" ");
                     } else {
-                        forUpdateString.append(" ").append(withRSClause)
+                        forUpdateString.append(" ").append(forReadOnlyClause)
+                            .append(" ").append(withRSClause)
                             .append(" ").append(useKeepExclusiveLockClause)
                             .append(" ");
                     }


Reply via email to