You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mi...@apache.org on 2009/03/01 21:08:16 UTC

svn commit: r749082 - /openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java

Author: mikedd
Date: Sun Mar  1 20:08:16 2009
New Revision: 749082

URL: http://svn.apache.org/viewvc?rev=749082&view=rev
Log:
OPENJPA-884. Merging revision 749077

Modified:
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=749082&r1=749081&r2=749082&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java (original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java Sun Mar  1 20:08:16 2009
@@ -232,8 +232,8 @@
         conn = super.decorate(conn);
 
         if (conf.getTransactionIsolationConstant() == -1
-            && conn.getTransactionIsolation() < conn.TRANSACTION_READ_COMMITTED)
-            conn.setTransactionIsolation(conn.TRANSACTION_READ_COMMITTED);
+            && conn.getTransactionIsolation() < Connection.TRANSACTION_READ_COMMITTED)
+            conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
 
         return conn;
     }
@@ -273,7 +273,7 @@
     	        db2ServerType = db2UDBV82OrLater;
         }
 
-        // verify that databae product is supported
+        // verify that database product is supported
         if (db2ServerType == 0 || maj == 0)
             throw new UnsupportedException(_loc.get("db-not-supported",
                 new Object[] {databaseProductName, databaseProductVersion }));                    
@@ -334,56 +334,50 @@
         int isolationLevel;
         // For db2UDBV81OrEarlier and db2ISeriesV5R3OrEarlier:
         // "optimize for" clause appears before "for update" clause.
-        StringBuffer forUpdateString = new StringBuffer(
-            getOptimizeClause(sel));
-        try {
-            // Determine the isolationLevel; the fetch
-            // configuration data overrides the persistence.xml value
-            if (fetch != null && fetch.getIsolation() != -1)
-                isolationLevel = fetch.getIsolation();
-            else
-                isolationLevel = conf.getTransactionIsolationConstant();
+        StringBuffer forUpdateString = new StringBuffer(getOptimizeClause(sel));
+        // Determine the isolationLevel; the fetch
+        // configuration data overrides the persistence.xml value
+        if (fetch != null && fetch.getIsolation() != -1)
+            isolationLevel = fetch.getIsolation();
+        else
+            isolationLevel = conf.getTransactionIsolationConstant();
 
-            if (isForUpdate) {
-                switch(db2ServerType) {
-                case db2ISeriesV5R3OrEarlier:
-                case db2UDBV81OrEarlier:
-                    if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE)
-                        forUpdateString.append(" ").append(forUpdateClause);
-                    else 
-                        forUpdateString.append(" ").append(forUpdate)
-                            .append(" ").append(withRSClause);
-                    break;
-                case db2ZOSV8xOrLater:
-                case db2UDBV82OrLater:
-                    if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) {
-                        forUpdateString.append(" ").append(forReadOnlyClause)
-                            .append(" ").append(withRRClause)
-                            .append(" ").append(useKeepUpdateLockClause);   
-                    } else {
-                        forUpdateString.append(" ").append(forReadOnlyClause)
-                            .append(" ").append(withRSClause)
-                            .append(" ").append(useKeepUpdateLockClause);                            
-                    }
-                    break;
-                case db2ISeriesV5R4OrLater:
-                    if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) {
-                        forUpdateString.append(" ").append(forReadOnlyClause)
-                            .append(" ").append(withRRClause)
-                            .append(" ").append(useKeepExclusiveLockClause);       
-                    } else {
-                        forUpdateString.append(" ").append(forReadOnlyClause)
-                            .append(" ").append(withRSClause)
-                            .append(" ").append(useKeepExclusiveLockClause);
-                    }
-                    break;
+        if (isForUpdate) {
+            switch (db2ServerType) {
+            case db2ISeriesV5R3OrEarlier:
+            case db2UDBV81OrEarlier:
+                if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE)
+                    forUpdateString.append(" ").append(forUpdateClause);
+                else
+                    forUpdateString.append(" ").append(forUpdate).append(" ")
+                        .append(withRSClause);
+                break;
+            case db2ZOSV8xOrLater:
+            case db2UDBV82OrLater:
+                if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) {
+                    forUpdateString.append(" ").append(forReadOnlyClause)
+                        .append(" ").append(withRRClause).append(" ").append(
+                            useKeepUpdateLockClause);
+                } else {
+                    forUpdateString.append(" ").append(forReadOnlyClause)
+                        .append(" ").append(withRSClause).append(" ").append(
+                            useKeepUpdateLockClause);
                 }
+                break;
+            case db2ISeriesV5R4OrLater:
+                if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) {
+                    forUpdateString.append(" ").append(forReadOnlyClause)
+                        .append(" ").append(withRRClause).append(" ").append(
+                            useKeepExclusiveLockClause);
+                } else {
+                    forUpdateString.append(" ").append(forReadOnlyClause)
+                        .append(" ").append(withRSClause).append(" ").append(
+                            useKeepExclusiveLockClause);
+                }
+                break;
             }
         }
-        catch (Exception e) {
-            if (log.isTraceEnabled())
-                log.error(e.toString(),e);
-        }
+   
         return forUpdateString.toString();
     }
 
@@ -461,7 +455,7 @@
     }
     
     private void getProductVersionMajorMinor() {
-        // Incase JDBC driver version is lower than 3
+        // In case JDBC driver version is lower than 3
         // use following info to determine Major and Minor 
         //                        CLI    vs      JCC
         // ZDBV8 DBProdName       DB2            DB2
@@ -508,8 +502,8 @@
     }
 
     /**
-     *  Append exception information from SQLCA to the exsisting
-     *  exception meassage
+     *  Append exception information from SQLCA to the existing
+     *  exception message
      */
     private String appendExtendedExceptionMsg(String msg, SQLException sqle){
        final String GETSQLCA ="getSqlca";
@@ -821,7 +815,7 @@
             Column pkColumn) {
         if (isDB2ZOSV8xOrLater()) {
             // build the index for the sequence tables
-            // the index name will the fully qualified table name + _IDX
+            // the index name will be the fully qualified table name + _IDX
             Table tab = schema.getTable(table);
             Index idx = tab.addIndex(tab.getFullName() + "_IDX");
             idx.setUnique(true);