db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r453090 - /db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
Date Thu, 05 Oct 2006 02:48:26 GMT
Author: clr
Date: Wed Oct  4 19:48:26 2006
New Revision: 453090

URL: http://svn.apache.org/viewvc?view=rev&rev=453090
Log:
JDO-415

Modified:
    db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java

Modified: db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
URL: http://svn.apache.org/viewvc/db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java?view=diff&rev=453090&r1=453089&r2=453090
==============================================================================
--- db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
(original)
+++ db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
Wed Oct  4 19:48:26 2006
@@ -86,12 +86,26 @@
                     "getDataStoreConnection AND SQLSupported.");
             return;
         }
+        getPM().currentTransaction().setOptimistic(false);
+        executeSQLWithDataStoreConnection();
+        if (!isOptimisticSupported()) {
+            printUnsupportedOptionalFeatureNotTested(
+                    this.getClass().getName(),
+                    "getDataStoreConnection AND SQLSupported AND Optimistic.");
+            return;
+        }
+        getPM().currentTransaction().setOptimistic(true);
+        executeSQLWithDataStoreConnection();
+    }
+
+    private void executeSQLWithDataStoreConnection() {
         String schema = getPMFProperty("javax.jdo.mapping.Schema");
         String sql = "SELECT X, Y FROM " + schema + ".PCPoint";
-        JDOConnection jconn = pm.getDataStoreConnection();
-        Connection conn = (Connection)jconn;
+        JDOConnection jconn = null;
         try {
             getPM().currentTransaction().begin();
+            jconn = pm.getDataStoreConnection();
+            Connection conn = (Connection)jconn;
             if (conn.getAutoCommit()) {
                 appendMessage(ASSERTION_FAILED + 
                         "Autocommit must not be true in JDO connection.");
@@ -123,6 +137,7 @@
             appendMessage(ASSERTION_FAILED + " caught exception:" + ex);
         } finally {
             jconn.close();
+            getPM().currentTransaction().commit();
             failOnError();
         }
     }



Mime
View raw message