openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r934608 - in /openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc: kernel/JDBCStoreManager.java meta/strats/RelationFieldStrategy.java sql/LogicalUnion.java sql/SelectExecutor.java sql/SelectImpl.java
Date Thu, 15 Apr 2010 21:49:05 GMT
Author: mikedd
Date: Thu Apr 15 21:49:05 2010
New Revision: 934608

URL: http://svn.apache.org/viewvc?rev=934608&view=rev
Log:
OPENJPA-1001: Revert original extensive changes

Modified:
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectExecutor.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=934608&r1=934607&r2=934608&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Thu Apr 15 21:49:05 2010
@@ -499,13 +499,90 @@ public class JDBCStoreManager 
     private Result getInitializeStateResult(OpenJPAStateManager sm,
         ClassMapping mapping, JDBCFetchConfiguration fetch, int subs)
         throws SQLException {
+        List params = new ArrayList();
+        Select sel = newSelect(sm, mapping, fetch, subs, params);
+        if (sel == null) return null;
+        return sel.execute(this, fetch, params);
+    }
+    
+    Map<SelectKey, Select> selectImplCacheMap = null;
+    private Select newSelect(OpenJPAStateManager sm,
+        ClassMapping mapping, JDBCFetchConfiguration fetch, int subs,
+        List params) {
+        if (!_isQuerySQLCache) 
+            return newSelect(sm, mapping, fetch, subs);       
+           
+        if (selectImplCacheMap == null) {
+            selectImplCacheMap =
+                getCacheMapFromQuerySQLCache(JDBCStoreManager.class);
+        }
+         
+        JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
+        fetchClone.copy(fetch);
+        SelectKey selKey = new SelectKey(mapping, null, fetchClone);
+        Select sel = null;
+        boolean found = true;
+        Object obj = selectImplCacheMap.get(selKey);
+        if (obj == null) {
+            synchronized (selectImplCacheMap) {
+                obj = selectImplCacheMap.get(selKey);
+                if (obj == null) {
+                    // Not found in cache, create a new select
+                    obj = newSelect(sm, mapping, fetch, subs);
+                    found = false;
+                }
+                    
+                if (obj == null) {
+                    // If the generated SelectImpl is null, store a generic
+                    // known object in the cache as a placeholder. Some map 
+                    // implementations do not allow null values.
+                    obj = _nullCacheValue;
+                    found = false;
+                }
+                else if (obj != _nullCacheValue)
+                {
+                    sel = (Select)obj;
+                    if (sel.getSQL() == null) {
+                        sel.setSQL(this, fetch);
+                        found = false;
+                    }
+                }
+                if (!found) {
+                    addToSqlCache(selectImplCacheMap, selKey, obj);
+                }
+            }
+        }
+
+        if (obj != null && obj != _nullCacheValue)
+            sel = (Select) obj;
+
+        Log log = _conf.getLog(JDBCConfiguration.LOG_JDBC);
+        if (log.isTraceEnabled()) {
+            if (!found)
+                log.trace(_loc.get("cache-missed", mapping, this.getClass()));
+            else
+                log.trace(_loc.get("cache-hit", mapping, this.getClass()));
+        }
+
+        if (sel == null)
+            return null;
+        
+        Object oid = sm.getObjectId();
+        Column[] cols = mapping.getPrimaryKeyColumns();
+        sel.wherePrimaryKey(mapping, cols, cols, oid, this, 
+        	null, null, params);
+        return sel;
+    }
+
+    protected Select newSelect(OpenJPAStateManager sm,
+        ClassMapping mapping, JDBCFetchConfiguration fetch, int subs) {
         Select sel = _sql.newSelect();
-        if (!select(sel, mapping, subs, sm, null, fetch, JDBCFetchConfiguration.EAGER_JOIN,
true, false)) {
+        if (!select(sel, mapping, subs, sm, null, fetch,
+            JDBCFetchConfiguration.EAGER_JOIN, true, false))
             return null;
-        }
         sel.wherePrimaryKey(sm.getObjectId(), mapping, this);
         sel.setExpectedResultCount(1, false);
-        return sel.execute(this, fetch);
+        return sel;
     }
 
     /**

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java?rev=934608&r1=934607&r2=934608&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
Thu Apr 15 21:49:05 2010
@@ -620,6 +620,99 @@ public class RelationFieldStrategy
         final int subs = field.getSelectSubclasses();
         final Joins[] resJoins = new Joins[rels.length];
 
+        //cache union for field here
+        //select data for this sm
+        Union union = null;
+        SelectImpl sel = null;
+        List parmList = null;
+
+        if (!((JDBCStoreManager)store).isQuerySQLCacheOn())
+            union = newUnion(sm, store, fetch, rels, subs, resJoins);
+        else {
+            if (relationFieldUnionCache == null) {
+                relationFieldUnionCache =
+                    ((JDBCStoreManager) store)
+                        .getCacheMapFromQuerySQLCache(RelationFieldStrategy.class);
+            }
+            boolean found = true;
+            JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
+            fetchClone.copy(fetch);
+            JDBCStoreManager.SelectKey selKey = 
+                new JDBCStoreManager.SelectKey(null, field, fetch);
+            Object[] obj = relationFieldUnionCache.get(selKey);
+            if (obj != null) {
+                union = (Union) obj[0];
+                resJoins[0] = (Joins)obj[1];
+            } else {
+                synchronized(relationFieldUnionCache) {
+                    obj = relationFieldUnionCache.get(selKey);
+                    if (obj != null) {
+                        union = (Union) obj[0];
+                        resJoins[0] = (Joins) obj[1];
+                    } else {
+                        // select related mapping columns; joining from the 
+                        // related type back to our fk table if not an inverse 
+                        // mapping (in which case we can just make sure the 
+                        // inverse cols == our pk values)
+                        union = newUnion(sm, store, fetch, rels, subs, 
+                                resJoins);
+                        found = false;                
+                    }
+                    sel = ((LogicalUnion.UnionSelect)union.getSelects()[0]).
+                        getDelegate();
+                    SQLBuffer buf = sel.getSQL();
+                    if (buf == null) {
+                    	((SelectImpl)sel).setSQL(store, fetch);
+                        found = false;
+                    }
+
+                    // only cache the union when elems length is 1 for now
+                    if (!found && rels.length == 1) {
+                        Object[] obj1 = new Object[2];
+                        obj1[0] = union;
+                        obj1[1] = resJoins[0];
+                        ((JDBCStoreManager)store).addToSqlCache(
+                            relationFieldUnionCache, selKey, obj1);
+                    }
+                }
+            }
+            Log log = store.getConfiguration().
+                getLog(JDBCConfiguration.LOG_JDBC);
+            if (log.isTraceEnabled()){
+                if (found) 
+                    log.trace(_loc.get("cache-hit", field, this.getClass()));           
            
+                else
+                    log.trace(_loc.get("cache-missed", field, this.getClass()));
+            }
+
+            parmList = new ArrayList();
+            ClassMapping mapping = field.getDefiningMapping();
+            Object oid = sm.getObjectId();
+            Column[] cols = mapping.getPrimaryKeyColumns();
+            if (sel == null)
+                sel = ((LogicalUnion.UnionSelect)union.getSelects()[0]).
+                getDelegate();
+
+            sel.wherePrimaryKey(mapping, cols, cols, oid, store, 
+            	null, null, parmList);
+        }
+        
+        Result res = union.execute(store, fetch, parmList);
+        try {
+            Object val = null;
+            if (res.next())
+                val = res.load(rels[res.indexOf()], store, fetch,
+                    resJoins[res.indexOf()]);
+            sm.storeObject(field.getIndex(), val);
+        } finally {
+            res.close();
+        }
+    }
+    
+    protected Union newUnion(final OpenJPAStateManager sm, 
+        final JDBCStore store, final JDBCFetchConfiguration fetch, 
+        final ClassMapping[] rels, final int subs, 
+        final Joins[] resJoins) {
         Union union = store.getSQLFactory().newUnion(rels.length);
         union.setExpectedResultCount(1, false);
         if (fetch.getSubclassFetchMode(field.getTypeMapping())
@@ -627,29 +720,20 @@ public class RelationFieldStrategy
             union.abortUnion();
         union.select(new Union.Selector() {
             public void select(Select sel, int idx) {
-                if (field.getJoinDirection() == field.JOIN_INVERSE) {
-                    sel.whereForeignKey(field.getForeignKey(rels[idx]), sm.getObjectId(),
field.getDefiningMapping(),
-                        store);
-                }
+                if (field.getJoinDirection() == field.JOIN_INVERSE)
+                    sel.whereForeignKey(field.getForeignKey(rels[idx]),
+                        sm.getObjectId(), field.getDefiningMapping(), store);
                 else {
-                    resJoins[idx] =
-                        sel.newJoins().joinRelation(field.getName(), field.getForeignKey(rels[idx]),
rels[idx],
-                            field.getSelectSubclasses(), false, false);
+                    resJoins[idx] = sel.newJoins().joinRelation(field.getName(),
+                        field.getForeignKey(rels[idx]), rels[idx],
+                        field.getSelectSubclasses(), false, false);
                     field.wherePrimaryKey(sel, sm, store);
                 }
-                sel.select(rels[idx], subs, store, fetch, fetch.EAGER_JOIN, resJoins[idx]);
+                sel.select(rels[idx], subs, store, fetch, fetch.EAGER_JOIN, 
+                    resJoins[idx]);
             }
         });
-        Result res = union.execute(store, fetch);
-        try {
-            Object val = null;
-            if (res.next()) {
-                val = res.load(rels[res.indexOf()], store, fetch, resJoins[res.indexOf()]);
-            }
-            sm.storeObject(field.getIndex(), val);
-        } finally {
-            res.close();
-        }
+        return union;
     }
 
     public Object toDataStoreValue(Object val, JDBCStore store) {

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java?rev=934608&r1=934607&r2=934608&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
Thu Apr 15 21:49:05 2010
@@ -59,7 +59,7 @@ public class LogicalUnion
     protected final BitSet desc = new BitSet();
     private boolean _distinct = true;
    
- 
+
     /**
      * Constructor.
      *
@@ -194,15 +194,6 @@ public class LogicalUnion
                 return false;
         return true;
     }
-    
-    public boolean hasMultipleSelects() {
-        for (UnionSelect sel : sels) {
-            if (sel.hasMultipleSelects()) {
-                return true;
-            }
-        }
-        return false;
-    }
 
     public int getCount(JDBCStore store)
         throws SQLException {
@@ -213,21 +204,32 @@ public class LogicalUnion
     }
 
     public Result execute(JDBCStore store, JDBCFetchConfiguration fetch)
+            throws SQLException {
+        return execute(store, fetch, null);
+    }    
+
+    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
+        int lockLevel)
         throws SQLException {
-        if (fetch == null) {
+        return execute(store, fetch, lockLevel, null);
+    }
+    
+    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, 
+        List params)
+        throws SQLException {
+        if (fetch == null)
             fetch = store.getFetchConfiguration();
-        }
-        return execute(store, fetch, fetch.getReadLockLevel());
+        return execute(store, fetch, fetch.getReadLockLevel(), params);
     }
 
     public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
-        int lockLevel)
+        int lockLevel, List params)
         throws SQLException {
         if (fetch == null)
             fetch = store.getFetchConfiguration();
 
         if (sels.length == 1) {
-            Result res = sels[0].execute(store, fetch, lockLevel);
+            Result res = sels[0].execute(store, fetch, lockLevel, params);
             ((AbstractResult) res).setBaseMapping(mappings[0]);
             return res;
         }
@@ -236,7 +238,7 @@ public class LogicalUnion
             AbstractResult res;
             for (int i = 0; i < sels.length; i++) {
                 res = (AbstractResult) sels[i].execute(store, fetch,
-                    lockLevel);
+                    lockLevel, params);
                 res.setBaseMapping(mappings[i]);
                 res.setIndexOf(i);
 
@@ -268,7 +270,7 @@ public class LogicalUnion
             List l;
             for (int i = 0; i < res.length; i++) {
                 res[i] = (AbstractResult) sels[i].execute(store, fetch,
-                    lockLevel);
+                    lockLevel, params);
                 res[i].setBaseMapping(mappings[i]);
                 res[i].setIndexOf(i);
 
@@ -402,16 +404,24 @@ public class LogicalUnion
         public boolean supportsLocking() {
             return sel.supportsLocking();
         }
-        
-        public boolean hasMultipleSelects() {
-            return sel.hasMultipleSelects();
-        }
 
         public int getCount(JDBCStore store)
             throws SQLException {
             return sel.getCount(store);
         }
 
+        public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, 
+            List params)
+            throws SQLException {
+            return sel.execute(store, fetch, params);
+        }
+
+        public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
+            int lockLevel, List params)
+            throws SQLException {
+            return sel.execute(store, fetch, lockLevel, params);
+        }
+
         public Result execute(JDBCStore store, JDBCFetchConfiguration fetch)
             throws SQLException {
             return sel.execute(store, fetch);
@@ -901,15 +911,6 @@ public class LogicalUnion
         public void setSchemaAlias(String schemaAlias) {
             sel.setSchemaAlias(schemaAlias);
         }
-
-        public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, List params)
throws SQLException {
-            return execute(store, fetch);
-        }
-
-        public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel,
List params)
-            throws SQLException {
-            return execute(store, fetch, lockLevel);
-        }
     }
 
     /**
@@ -990,13 +991,4 @@ public class LogicalUnion
             return a1.length - a2.length;
         }
     }
-
-    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, List params) throws
SQLException {
-        return execute(store, fetch);
-    }
-
-    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel, List
params)
-        throws SQLException {
-        return execute(store, fetch, lockLevel);
-    }
 }

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectExecutor.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectExecutor.java?rev=934608&r1=934607&r2=934608&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectExecutor.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectExecutor.java
Thu Apr 15 21:49:05 2010
@@ -132,7 +132,6 @@ public interface SelectExecutor {
 
     /**
      * Execute this select in the context of the given store manager.
-     * @deprecated
      */
     public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
         List params) 
@@ -140,7 +139,6 @@ public interface SelectExecutor {
 
     /**
      * Execute this select in the context of the given store manager.
-     * @deprecated
      */
     public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
         int lockLevel, List params)
@@ -150,13 +148,6 @@ public interface SelectExecutor {
      * Execute this select in the context of the given store manager.
      */
     public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
-        int lockLevel) 
+        int lockLevel)
         throws SQLException;
-
-    /**
-     * Execute this select in the context of the given store manager.
-     * Affirm if this receiver requires more than one selects to fetch its
-     * data. 
-     */
-    public boolean hasMultipleSelects();
 }

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=934608&r1=934607&r2=934608&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
Thu Apr 15 21:49:05 2010
@@ -305,20 +305,6 @@ public class SelectImpl
     public boolean supportsLocking() {
         return _dict.supportsLocking(this);
     }
-    
-    public boolean hasMultipleSelects() {
-        if (_eager == null) {
-            return false;
-        }
-        Map.Entry entry;
-        for (Iterator itr = _eager.entrySet().iterator(); itr.hasNext();) {
-            entry = (Map.Entry) itr.next();
-            if (entry.getValue() != this) {
-                return true;
-            }
-        }
-        return false;
-    }
 
     public int getCount(JDBCStore store)
         throws SQLException {
@@ -331,7 +317,7 @@ public class SelectImpl
             stmnt = prepareStatement(conn, sql, null, 
                 ResultSet.TYPE_FORWARD_ONLY, 
                 ResultSet.CONCUR_READ_ONLY, false);
-            rs = executeQuery(conn, stmnt, sql, false, store);
+            rs = executeQuery(conn, stmnt, sql, false, store, null);
             return getCount(rs);
         } finally {
             if (rs != null)
@@ -343,21 +329,31 @@ public class SelectImpl
         }
     }
 
-    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch)
-        throws SQLException {
+    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, 
+        List parms) throws SQLException {
         if (fetch == null)
             fetch = store.getFetchConfiguration();
         return execute(store.getContext(), store, fetch,
-            fetch.getReadLockLevel());
+            fetch.getReadLockLevel(), parms);
+    }
+
+    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch) 
+        throws SQLException {
+        return execute(store, fetch, null);
+     }
+
+    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
+        int lockLevel, List parms)
+        throws SQLException {
+            if (fetch == null)
+                fetch = store.getFetchConfiguration();
+            return execute(store.getContext(), store, fetch, lockLevel, parms);
     }
 
     public Result execute(JDBCStore store, JDBCFetchConfiguration fetch,
         int lockLevel)
         throws SQLException {
-        if (fetch == null) {
-            fetch = store.getFetchConfiguration();
-        }
-        return execute(store.getContext(), store, fetch, lockLevel);
+        return execute(store, fetch, lockLevel, null);
     }
 
     /**
@@ -365,7 +361,7 @@ public class SelectImpl
      * context is passed in separately for profiling purposes.
      */
     protected Result execute(StoreContext ctx, JDBCStore store, 
-        JDBCFetchConfiguration fetch, int lockLevel)
+        JDBCFetchConfiguration fetch, int lockLevel, List params)
         throws SQLException {
         boolean forUpdate = isForUpdate(store, lockLevel);
         
@@ -388,13 +384,15 @@ public class SelectImpl
         ResultSet rs = null;
         try {
             if (isLRS) 
-                stmnt = prepareStatement(conn, _sql, fetch, rsType, -1, true); 
+                stmnt = prepareStatement(conn, _sql, fetch, rsType, -1, true, 
+                        params); 
             else
-                stmnt = prepareStatement(conn, _sql, null, rsType, -1, false);
+                stmnt = prepareStatement(conn, _sql, null, rsType, -1, false, 
+                        params);
             
             setTimeout(stmnt, forUpdate, fetch);
             
-            rs = executeQuery(conn, stmnt, _sql, isLRS, store);
+            rs = executeQuery(conn, stmnt, _sql, isLRS, store, params);
         } catch (SQLException se) {
             // clean up statement
             if (stmnt != null)
@@ -403,7 +401,8 @@ public class SelectImpl
             throw se;
         }
 
-        return getEagerResult(conn, stmnt, rs, store, fetch, forUpdate, _sql);
+        return getEagerResult(conn, stmnt, rs, store, fetch, forUpdate, 
+            _sql.getSQL(), params);
     }
     
     private boolean isForUpdate(JDBCStore store, int lockLevel) {
@@ -421,7 +420,7 @@ public class SelectImpl
      * to the given result.
      */
     private static void addEagerResults(SelectResult res, SelectImpl sel,
-        JDBCStore store, JDBCFetchConfiguration fetch)
+        JDBCStore store, JDBCFetchConfiguration fetch, List params)
         throws SQLException {
         if (sel._eager == null)
             return;
@@ -440,7 +439,7 @@ public class SelectImpl
                 eres = res;
             else
                 eres = ((SelectExecutor) entry.getValue()).execute(store,
-                    fetch);
+                    fetch, params);
 
             eager = res.getEagerMap(false);
             if (eager == null) {
@@ -451,10 +450,17 @@ public class SelectImpl
         }
     }
 
+
+    /**
+     * This method is to provide override for non-JDBC or JDBC-like 
+     * implementation of preparing statement.
+     */
     protected PreparedStatement prepareStatement(Connection conn, 
         SQLBuffer sql, JDBCFetchConfiguration fetch, int rsType, 
-        int rsConcur, boolean isLRS, List params) throws SQLException {
-        return prepareStatement(conn, sql, fetch, rsType, rsConcur, isLRS);
+        int rsConcur, boolean isLRS) throws SQLException {
+        // add comments why we pass in null as the last parameter
+        return prepareStatement(conn, sql, fetch, rsType, rsConcur, isLRS, 
+                null);
     }
 
     /**
@@ -463,11 +469,11 @@ public class SelectImpl
      */
     protected PreparedStatement prepareStatement(Connection conn, 
         SQLBuffer sql, JDBCFetchConfiguration fetch, int rsType, 
-        int rsConcur, boolean isLRS) throws SQLException {
+        int rsConcur, boolean isLRS, List params) throws SQLException {
         if (fetch == null)
-            return sql.prepareStatement(conn, rsType, rsConcur);
+            return sql.prepareStatement(conn, rsType, rsConcur, params);
         else
-            return sql.prepareStatement(conn, fetch, rsType, -1);
+            return sql.prepareStatement(conn, fetch, rsType, -1, params);
     }
     
     /**
@@ -509,7 +515,7 @@ public class SelectImpl
      * implementation of executing query.
      */
     protected ResultSet executeQuery(Connection conn, PreparedStatement stmnt, 
-        SQLBuffer sql, boolean isLRS, JDBCStore store) 
+        SQLBuffer sql, boolean isLRS, JDBCStore store, List params) 
         throws SQLException {
         return stmnt.executeQuery();
     }
@@ -529,14 +535,15 @@ public class SelectImpl
      */
     protected Result getEagerResult(Connection conn, 
         PreparedStatement stmnt, ResultSet rs, JDBCStore store, 
-        JDBCFetchConfiguration fetch, boolean forUpdate, SQLBuffer sql) 
+        JDBCFetchConfiguration fetch, boolean forUpdate, String sqlStr,
+        List params) 
         throws SQLException {
         SelectResult res = new SelectResult(conn, stmnt, rs, _dict);
         res.setSelect(this);
         res.setStore(store);
         res.setLocking(forUpdate);
         try {
-            addEagerResults(res, this, store, fetch);
+            addEagerResults(res, this, store, fetch, params);
         } catch (SQLException se) {
             res.close();
             throw se;
@@ -1407,11 +1414,10 @@ public class SelectImpl
                 val = pks[mapping.getField(join.getFieldIndex()).
                     getPrimaryKeyIndex()];
                 val = join.getJoinValue(val, toCols[i], store);
-                
-                if (parmList != null) {
+                if (parmList != null)
                 	parmList.add(val);
-                }
             }
+            
             if (collectParmValueOnly) 
             	continue;
             
@@ -3227,15 +3233,6 @@ public class SelectImpl
 
     public void moveJoinsToParent() {
     }
-
-    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, List params) throws
SQLException {
-        return execute(store, fetch); 
-    }
-
-    public Result execute(JDBCStore store, JDBCFetchConfiguration fetch, int lockLevel, List
params)
-        throws SQLException {
-        return execute(store, fetch, lockLevel);
-    }
 }
 
 /**



Mime
View raw message