openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1158027 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/
Date Mon, 15 Aug 2011 21:54:40 GMT
Author: curtisr7
Date: Mon Aug 15 21:54:40 2011
New Revision: 1158027

URL: http://svn.apache.org/viewvc?rev=1158027&view=rev
Log:
OPENJPA-2039: Update configuration properties.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/DelegatingJDBCFetchConfiguration.java
Mon Aug 15 21:54:40 2011
@@ -294,4 +294,21 @@ public class DelegatingJDBCFetchConfigur
             throw translate(re);
         }
     }
+    @Override
+    public void setIgnoreDfgForFkSelect(boolean b) {
+        try {
+            getJDBCDelegate().setIgnoreDfgForFkSelect(b);
+        } catch (RuntimeException re) {
+            throw translate(re);
+        }
+    }
+
+    @Override
+    public boolean getIgnoreDfgForFkSelect() {
+        try {
+            return getJDBCDelegate().getIgnoreDfgForFkSelect();
+        } catch (RuntimeException re) {
+            throw translate(re);
+        }
+    }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfiguration.java
Mon Aug 15 21:54:40 2011
@@ -241,4 +241,20 @@ public interface JDBCFetchConfiguration
      * @since 1.0.3
      */
     public JDBCFetchConfiguration addFetchInnerJoins(Collection<String> fields);
+    
+    /**
+     * If true - Ignore whether or not a field is in the dfg for mappings that use 2-part
selects to load fk table data.
+     * 
+     * @since 2.2.0
+     * @return false
+     */
+    public boolean getIgnoreDfgForFkSelect();
+
+    /**
+     * If true - Ignore whether or not a field is in the dfg for mappings that use 2-part
selects to load fk table data.
+     * 
+     * @since 2.2.0
+     * @return false
+     */
+    public void setIgnoreDfgForFkSelect(boolean b);
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCFetchConfigurationImpl.java
Mon Aug 15 21:54:40 2011
@@ -92,6 +92,7 @@ public class JDBCFetchConfigurationImpl
         public Set<String> joins = null;
         public Set<String> fetchInnerJoins = null;
         public int isolationLevel = -1;
+        public boolean ignoreDfgForFkSelect = false;
     }
 
     protected final JDBCConfigurationState _state;
@@ -135,8 +136,17 @@ public class JDBCFetchConfigurationImpl
         setLRSSize(jf.getLRSSize());
         setJoinSyntax(jf.getJoinSyntax());
         addJoins(jf.getJoins());
+        setIgnoreDfgForFkSelect(jf.getIgnoreDfgForFkSelect());
     }
 
+    @Override
+    public boolean getIgnoreDfgForFkSelect() {
+        return _state.ignoreDfgForFkSelect;
+    }
+    @Override
+    public void setIgnoreDfgForFkSelect(boolean b) {
+        _state.ignoreDfgForFkSelect = b;
+    }
     public int getEagerFetchMode() {
         return _state.eagerMode;
     }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Mon Aug 15 21:54:40 2011
@@ -111,7 +111,6 @@ public class JDBCStoreManager implements
     private RefCountConnection _conn = null;
     private boolean _active = false;
     private Log _log = null;
-    boolean _ignoreDfgForFkSelect = false;
     
     // track the pending statements so we can cancel them
     private Set<Statement> _stmnts = Collections.synchronizedSet(new HashSet<Statement>());
@@ -1410,7 +1409,7 @@ public class JDBCStoreManager implements
      */
     private boolean optSelect(FieldMapping fm, Select sel, OpenJPAStateManager sm, JDBCFetchConfiguration
fetch) {
         boolean dfg =
-            _ignoreDfgForFkSelect || 
+            fetch.getIgnoreDfgForFkSelect() || 
                 !fm.isInDefaultFetchGroup() && !fm.isDefaultFetchGroupExplicit();
 
         return dfg && (sm == null || sm.getPCState() == PCState.TRANSIENT || !sm.getLoaded().get(fm.getIndex()))
@@ -1551,10 +1550,6 @@ public class JDBCStoreManager implements
              ? getConfiguration().getFinderCacheInstance() : null;
     }
 
-    public void setIgnoreDfgForFkSelect(boolean b) {
-        _ignoreDfgForFkSelect = b;
-    }
-
     /**
      * Connection returned to client code. Makes sure its wrapped connection ref count is
decremented on finalize.
      */

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java
Mon Aug 15 21:54:40 2011
@@ -227,4 +227,20 @@ public interface JDBCFetchPlan
      * @deprecated use {@link #setJoinSyntax(JoinSyntax)} instead.
      */
     public JDBCFetchPlan setJoinSyntax(int syntax);
+    
+    /**
+     * If true - Ignore whether or not a field is in the dfg for mappings that use 2-part
selects to load fk table data.
+     * 
+     * @since 2.2.0
+     * @return false
+     */
+    public boolean getIgnoreDfgForFkSelect();
+
+    /**
+     * If true - Ignore whether or not a field is in the dfg for mappings that use 2-part
selects to load fk table data.
+     * 
+     * @since 2.2.0
+     * @return false
+     */
+    public void setIgnoreDfgForFkSelect(boolean b);
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
Mon Aug 15 21:54:40 2011
@@ -20,8 +20,6 @@ package org.apache.openjpa.persistence.j
 
 import java.sql.ResultSet;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
 import javax.persistence.LockModeType;
 
@@ -343,4 +341,14 @@ public class JDBCFetchPlanImpl
     public JDBCFetchPlan setQueryTimeout(int timeout) {
         return (JDBCFetchPlan) super.setQueryTimeout(timeout);
     }
+
+    @Override
+    public boolean getIgnoreDfgForFkSelect() {
+        return _fetch.getIgnoreDfgForFkSelect();
+    }
+
+    @Override
+    public void setIgnoreDfgForFkSelect(boolean b) {
+        _fetch.setIgnoreDfgForFkSelect(b);
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java?rev=1158027&r1=1158026&r2=1158027&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/kernel/TestJDBCStoreOptSelect.java
Mon Aug 15 21:54:40 2011
@@ -27,10 +27,12 @@ import org.apache.openjpa.meta.MetaDataR
 import org.apache.openjpa.persistence.EntityManagerImpl;
 import org.apache.openjpa.persistence.FetchPlan;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
+import org.apache.openjpa.persistence.jdbc.JDBCFetchPlan;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 
 public class TestJDBCStoreOptSelect extends SQLListenerTestCase {
-    Object[] props = new Object[] { CLEAR_TABLES, OptSelectEntity.class };
+    Object[] props = new Object[] { CLEAR_TABLES, OptSelectEntity.class
+        };
     OptSelectEntity e1, e2;
 
     @Override
@@ -50,10 +52,11 @@ public class TestJDBCStoreOptSelect exte
             if (store instanceof JDBCStoreManager == false) {
                 fail("StoreManager is not an instanceof JDBCStoreManager");
             }
-            // Set this JDBCStoreManager property so that we will select FKs for fields that
are in the DFG, but not
-            // included in the current select.
-            ((JDBCStoreManager) store).setIgnoreDfgForFkSelect(true);
-
+            // Set this JDBCFetchPlan property so that we will select FKs for fields that
are in the DFG, but not
+            // included in the current load. If this property isn't set, the FK for eagerOneToOneOwner
will not be
+            // selected.
+             ((JDBCFetchPlan)fp).setIgnoreDfgForFkSelect(true);
+ 
             // Remove all relationships
             fp.removeField(OptSelectEntity.class, "eagerOneToOne");
             fp.removeField(OptSelectEntity.class, "eagerOneToOneOwner");
@@ -77,6 +80,7 @@ public class TestJDBCStoreOptSelect exte
                     fks++;
                 }
             }
+            // We expected to find 2 FKs. One for each of the owners (lazyOneToOneOwner and
eagerOneToOneOwner)
             assertEquals(2, fks);
         } finally {
             if (em.getTransaction().isActive()) {



Mime
View raw message