openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awh...@apache.org
Subject svn commit: r441158 [4/5] - in /incubator/openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-kernel/s...
Date Thu, 07 Sep 2006 17:51:09 GMT
Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StartsWithExpression.java Thu Sep  7 10:51:05 2006
@@ -17,14 +17,11 @@
 
 import java.util.Map;
 
-import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.meta.FieldMapping;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.schema.Table;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
-import org.apache.openjpa.jdbc.sql.Joins;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
 import org.apache.openjpa.kernel.exps.ExpressionVisitor;
@@ -40,9 +37,6 @@
 
     private final Val _val1;
     private final Val _val2;
-    private Joins _joins = null;
-    private String _pre = null;
-    private String _post = null;
 
     /**
      * Constructor. Supply values.
@@ -52,70 +46,67 @@
         _val2 = val2;
     }
 
-    public void initialize(Select sel, JDBCStore store,
-        Object[] params, Map contains) {
-        _val1.initialize(sel, store, false);
-        _val2.initialize(sel, store, false);
-        _joins = sel.and(_val1.getJoins(), _val2.getJoins());
-
-        DBDictionary dict = store.getDBDictionary();
-        String func = dict.stringLengthFunction;
-        if (func != null) {
-            int idx = func.indexOf("{0}");
-            _pre = func.substring(0, idx);
-            _post = func.substring(idx + 3);
-        }
+    public ExpState initialize(Select sel, ExpContext ctx, Map contains) {
+        ExpState s1 = _val1.initialize(sel, ctx, 0);
+        ExpState s2 = _val2.initialize(sel, ctx, 0);
+        return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2);
     }
 
-    public void appendTo(SQLBuffer buf, Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        _val1.calculateValue(sel, store, params, _val2, fetch);
-        _val2.calculateValue(sel, store, params, _val1, fetch);
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf) {
+        BinaryOpExpState bstate = (BinaryOpExpState) state;
+        _val1.calculateValue(sel, ctx, bstate.state1, _val2, bstate.state2);
+        _val2.calculateValue(sel, ctx, bstate.state2, _val1, bstate.state1);
 
-        if (_val1 instanceof Const && ((Const) _val1).getValue() == null)
+        if (_val1 instanceof Const 
+            && ((Const) _val1).getValue(ctx, bstate.state1) == null)
             buf.append("1 <> 1");
         else if (_val2 instanceof Const) {
-            Object o = ((Const) _val2).getValue();
+            Object o = ((Const) _val2).getValue(ctx, bstate.state2);
             if (o == null)
                 buf.append("1 <> 1");
             else {
                 Column col = null;
                 if (_val1 instanceof PCPath) {
-                    Column[] cols = ((PCPath) _val1).getColumns();
+                    Column[] cols = ((PCPath) _val1).getColumns(bstate.state1);
                     if (cols.length == 1)
                         col = cols[0];
                 }
 
-                _val1.appendTo(buf, 0, sel, store, params, fetch);
+                _val1.appendTo(sel, ctx, bstate.state1, buf, 0);
                 buf.append(" LIKE ");
                 buf.appendValue(o.toString() + "%", col);
             }
         } else {
+            String pre = null;
+            String post = null;
+            DBDictionary dict = ctx.store.getDBDictionary();
+            String func = dict.stringLengthFunction;
+            if (func != null) {
+                int idx = func.indexOf("{0}");
+                pre = func.substring(0, idx);
+                post = func.substring(idx + 3);
+            }
+
             // if we can't use LIKE, we have to take the substring of the
             // first value and compare it to the second
-            DBDictionary dict = store.getDBDictionary();
-            dict.assertSupport(_pre != null, "StringLengthFunction");
+            dict.assertSupport(pre != null, "StringLengthFunction");
             dict.substring(buf,
-                new FilterValueImpl(_val1, sel, store, params, fetch),
-                new ZeroFilterValue(sel),
-                new StringLengthFilterValue(sel, store, params, fetch));
+                new FilterValueImpl(sel, ctx, bstate.state1, _val1),
+                new ZeroFilterValue(sel, state),
+                new StringLengthFilterValue(sel, ctx, bstate.state2, pre,post));
             buf.append(" = ");
-            _val2.appendTo(buf, 0, sel, store, params, fetch);
+            _val2.appendTo(sel, ctx, bstate.state2, buf, 0);
         }
 
-        sel.append(buf, _joins);
-        _val1.clearParameters();
-        _val2.clearParameters();
-    }
-
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
-        _val1.selectColumns(sel, store, params, true, fetch);
-        _val2.selectColumns(sel, store, params, true, fetch);
+        sel.append(buf, state.joins);
     }
 
-    public Joins getJoins() {
-        return _joins;
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        BinaryOpExpState bstate = (BinaryOpExpState) state;
+        _val1.selectColumns(sel, ctx, bstate.state1, true);
+        _val2.selectColumns(sel, ctx, bstate.state2, true);
     }
 
     public void acceptVisit(ExpressionVisitor visitor) {
@@ -128,13 +119,15 @@
     /**
      * Evaluates to 0.
      */
-    private class ZeroFilterValue
+    private static class ZeroFilterValue
         implements FilterValue {
 
         private final Select _sel;
+        private final ExpState _state;
 
-        public ZeroFilterValue(Select sel) {
+        public ZeroFilterValue(Select sel, ExpState state) {
             _sel = sel;
+            _state = state;
         }
 
         public Class getType() {
@@ -154,11 +147,11 @@
         }
 
         public String getColumnAlias(Column col) {
-            return _sel.getColumnAlias(col, _joins);
+            return _sel.getColumnAlias(col, _state.joins);
         }
 
         public String getColumnAlias(String col, Table table) {
-            return _sel.getColumnAlias(col, table, _joins);
+            return _sel.getColumnAlias(col, table, _state.joins);
         }
 
         public Object toDataStoreValue(Object val) {
@@ -197,16 +190,18 @@
         implements FilterValue {
 
         private final Select _sel;
-        private final JDBCStore _store;
-        private final Object[] _params;
-        private final JDBCFetchConfiguration _fetch;
+        private final ExpContext _ctx;
+        private final ExpState _state;
+        private final String _pre;
+        private final String _post;
 
-        public StringLengthFilterValue(Select sel, JDBCStore store,
-            Object[] params, JDBCFetchConfiguration fetch) {
+        public StringLengthFilterValue(Select sel, ExpContext ctx, 
+            ExpState state, String pre, String post){
             _sel = sel;
-            _store = store;
-            _params = params;
-            _fetch = fetch;
+            _ctx = ctx;
+            _state = state;
+            _pre = pre;
+            _post = post;
         }
 
         public Class getType() {
@@ -223,20 +218,20 @@
 
         public void appendTo(SQLBuffer buf, int index) {
             buf.append(_pre);
-            _val2.appendTo(buf, index, _sel, _store, _params, _fetch);
+            _val2.appendTo(_sel, _ctx, _state, buf, index);
             buf.append(_post);
         }
 
         public String getColumnAlias(Column col) {
-            return _sel.getColumnAlias(col, _val2.getJoins());
+            return _sel.getColumnAlias(col, _state.joins);
         }
 
         public String getColumnAlias(String col, Table table) {
-            return _sel.getColumnAlias(col, table, _val2.getJoins());
+            return _sel.getColumnAlias(col, table, _state.joins);
         }
 
         public Object toDataStoreValue(Object val) {
-            return _val2.toDataStoreValue(val, _store);
+            return _val2.toDataStoreValue(_sel, _ctx, _state, val);
         }
 
         public boolean isConstant() {

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringFunction.java Thu Sep  7 10:51:05 2006
@@ -36,10 +36,8 @@
 abstract class StringFunction
     extends AbstractVal {
 
-    final Val _val;
-    ClassMetaData _meta = null;
-    String _pre = null;
-    String _post = null;
+    private final Val _val;
+    private ClassMetaData _meta = null;
 
     /**
      * Constructor. Provide the string to operate on.
@@ -48,6 +46,10 @@
         _val = val;
     }
 
+    public Val getValue() {
+        return _val;
+    }
+
     public ClassMetaData getMetaData() {
         return _meta;
     }
@@ -56,10 +58,6 @@
         _meta = meta;
     }
 
-    public boolean isVariable() {
-        return false;
-    }
-
     public Class getType() {
         return String.class;
     }
@@ -67,68 +65,49 @@
     public void setImplicitType(Class type) {
     }
 
-    public Joins getJoins() {
-        return _val.getJoins();
-    }
-
-    public Object toDataStoreValue(Object val, JDBCStore store) {
-        return val;
+    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
+        return _val.initialize(sel, ctx, flags);
     }
 
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch) {
-        sel.select(newSQLBuffer(sel, store, params, fetch), this);
+    public void select(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        sel.select(newSQLBuffer(sel, ctx, state), this);
     }
 
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
-        _val.selectColumns(sel, store, params, true, fetch);
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        _val.selectColumns(sel, ctx, state, true);
     }
 
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch) {
-        sel.groupBy(newSQLBuffer(sel, store, params, fetch));
+    public void groupBy(Select sel, ExpContext ctx, ExpState state) {
+        sel.groupBy(newSQLBuffer(sel, ctx, state));
     }
 
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch) {
-        sel.orderBy(newSQLBuffer(sel, store, params, fetch), asc, false);
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc) {
+        sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false);
     }
 
-    private SQLBuffer newSQLBuffer(Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        calculateValue(sel, store, params, null, fetch);
-        SQLBuffer buf = new SQLBuffer(store.getDBDictionary());
-        appendTo(buf, 0, sel, store, params, fetch);
-        clearParameters();
+    private SQLBuffer newSQLBuffer(Select sel, ExpContext ctx, ExpState state) {
+        calculateValue(sel, ctx, state, null, null);
+        SQLBuffer buf = new SQLBuffer(ctx.store.getDBDictionary());
+        appendTo(sel, ctx, state, buf, 0);
         return buf;
     }
 
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res)
         throws SQLException {
         return Filters.convert(res.getObject(this,
             JavaSQLTypes.JDBC_DEFAULT, null), getType());
     }
 
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch) {
-        _val.calculateValue(sel, store, params, null, fetch);
-    }
-
-    public void clearParameters() {
-        _val.clearParameters();
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState) {
+        _val.calculateValue(sel, ctx, state, null, null);
     }
 
-    public int length() {
+    public int length(Select sel, ExpContext ctx, ExpState state) {
         return 1;
-    }
-
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
-        sql.append(_pre);
-        _val.appendTo(sql, 0, sel, store, params, fetch);
-        sql.append(_post);
     }
 
     public void acceptVisit(ExpressionVisitor visitor) {

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/StringLength.java Thu Sep  7 10:51:05 2006
@@ -17,6 +17,7 @@
 
 import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
 
 /**
@@ -36,18 +37,6 @@
         super(val);
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-        _val.initialize(sel, store, false);
-
-        DBDictionary dict = store.getConfiguration().getDBDictionaryInstance();
-        String func = dict.stringLengthFunction;
-        dict.assertSupport(func != null, "StringLengthFunction");
-
-        int idx = func.indexOf("{0}");
-        _pre = func.substring(0, idx);
-        _post = func.substring(idx + 3);
-    }
-
     public Class getType() {
         if (_cast != null)
             return _cast;
@@ -56,6 +45,18 @@
 
     public void setImplicitType(Class type) {
         _cast = type;
+    }
+
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf, int index) {
+        DBDictionary dict = ctx.store.getDBDictionary();
+        String func = dict.stringLengthFunction;
+        dict.assertSupport(func != null, "StringLengthFunction");
+
+        int idx = func.indexOf("{0}");
+        buf.append(func.substring(0, idx));
+        getValue().appendTo(sel, ctx, state, buf, index);
+        buf.append(func.substring(idx + 3));
     }
 }
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SubQ.java Thu Sep  7 10:51:05 2006
@@ -18,10 +18,8 @@
 import java.sql.SQLException;
 
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.meta.JavaSQLTypes;
-import org.apache.openjpa.jdbc.sql.Joins;
 import org.apache.openjpa.jdbc.sql.Result;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
@@ -82,10 +80,6 @@
         _type = type;
     }
 
-    public boolean isVariable() {
-        return false;
-    }
-
     public ClassMetaData getMetaData() {
         return _meta;
     }
@@ -102,101 +96,95 @@
         _exps = query;
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-    }
-
-    public Joins getJoins() {
-        return null;
+    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
+        if (_exps.projections.length == 1)
+            return ((Val) _exps.projections[0]).initialize(sel, ctx, flags);
+        return ExpState.NULL;
     }
 
-    public Object toDataStoreValue(Object val, JDBCStore store) {
+    public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, 
+        Object val) {
         if (_exps.projections.length == 0)
             return _candidate.toDataStoreValue(val,
-                _candidate.getPrimaryKeyColumns(), store);
+                _candidate.getPrimaryKeyColumns(), ctx.store);
         if (_exps.projections.length == 1)
-            return ((Val) _exps.projections[0]).toDataStoreValue(val, store);
+            return ((Val) _exps.projections[0]).toDataStoreValue(sel, ctx, 
+                state, val);
         return val;
     }
 
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch) {
-        selectColumns(sel, store, params, pks, fetch);
+    public void select(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        selectColumns(sel, ctx, state, pks);
     }
 
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
-        sel.select(newSQLBuffer(sel, store, params, fetch), this);
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        sel.select(newSQLBuffer(sel, ctx, state), this);
     }
 
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch) {
-        sel.groupBy(newSQLBuffer(sel, store, params, fetch));
+    public void groupBy(Select sel, ExpContext ctx, ExpState state) {
+        sel.groupBy(newSQLBuffer(sel, ctx, state));
     }
 
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch) {
-        sel.orderBy(newSQLBuffer(sel, store, params, fetch), asc, false);
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc) {
+        sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false);
     }
 
-    private SQLBuffer newSQLBuffer(Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        SQLBuffer buf = new SQLBuffer(store.getDBDictionary());
-        appendTo(buf, 0, sel, store, params, fetch);
+    private SQLBuffer newSQLBuffer(Select sel, ExpContext ctx, ExpState state) {
+        SQLBuffer buf = new SQLBuffer(ctx.store.getDBDictionary());
+        appendTo(sel, ctx, state, buf, 0);
         return buf;
     }
 
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res) 
         throws SQLException {
         return Filters.convert(res.getObject(this,
             JavaSQLTypes.JDBC_DEFAULT, null), getType());
     }
 
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch) {
-    }
-
-    public void clearParameters() {
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState) {
     }
 
-    public int length() {
+    public int length(Select sel, ExpContext ctx, ExpState state) {
         return 1;
     }
 
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
-        appendTo(sql, index, sel, store, params, fetch, false);
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index) {
+        appendTo(sel, ctx, state, sql, index, false);
     }
 
-    private void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch,
-        boolean size) {
-        sel = _cons.evaluate(store, sel, _alias, _exps, params,
-            _cons.CACHE_NULL, fetch);
-        _cons.select(store, _candidate, _subs, sel, _exps, params,
-            fetch, fetch.EAGER_NONE);
+    private void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index, boolean size) {
+        QueryExpressionsState substate = new QueryExpressionsState();
+        Select sub = _cons.evaluate(ctx, sel, _alias, _exps, substate);
+        _cons.select(sub, ctx, _candidate, _subs, _exps, substate, 
+            JDBCFetchConfiguration.EAGER_NONE);
 
         if (size)
-            sql.appendCount(sel, fetch);
+            sql.appendCount(sub, ctx.fetch);
         else
-            sql.append(sel, fetch);
+            sql.append(sub, ctx.fetch);
     }
 
-    public void appendIsEmpty(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql) {
         sql.append("NOT EXISTS ");
-        appendTo(sql, 0, sel, store, params, fetch);
+        appendTo(sel, ctx, state, sql, 0);
     }
 
-    public void appendIsNotEmpty(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql) {
         sql.append("EXISTS ");
-        appendTo(sql, 0, sel, store, params, fetch);
+        appendTo(sel, ctx, state, sql, 0);
     }
 
-    public void appendSize(SQLBuffer sql, Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        appendTo(sql, 0, sel, store, params, fetch, true);
+    public void appendSize(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql) {
+        appendTo(sel, ctx, state, sql, 0, true);
     }
 
     public void acceptVisit(ExpressionVisitor visitor) {

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Substring.java Thu Sep  7 10:51:05 2006
@@ -17,10 +17,7 @@
 
 import java.sql.SQLException;
 
-import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.JavaSQLTypes;
-import org.apache.openjpa.jdbc.sql.Joins;
 import org.apache.openjpa.jdbc.sql.Result;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
@@ -38,7 +35,6 @@
 
     private final Val _val1;
     private final Val _val2;
-    private Joins _joins = null;
     private ClassMetaData _meta = null;
 
     /**
@@ -57,10 +53,6 @@
         _meta = meta;
     }
 
-    public boolean isVariable() {
-        return false;
-    }
-
     public Class getType() {
         return String.class;
     }
@@ -68,86 +60,72 @@
     public void setImplicitType(Class type) {
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-        _val1.initialize(sel, store, false);
-        _val2.initialize(sel, store, false);
-        _joins = sel.and(_val1.getJoins(), _val2.getJoins());
-    }
-
-    public Joins getJoins() {
-        return _joins;
+    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
+        ExpState s1 = _val1.initialize(sel, ctx, 0);
+        ExpState s2 = _val2.initialize(sel, ctx, 0);
+        return new BinaryOpExpState(sel.and(s1.joins, s2.joins), s1, s2);
     }
 
-    public Object toDataStoreValue(Object val, JDBCStore store) {
-        return val;
+    public void select(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        sel.select(newSQLBuffer(sel, ctx, state), this);
     }
 
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch) {
-        sel.select(newSQLBuffer(sel, store, params, fetch), this);
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        BinaryOpExpState bstate = (BinaryOpExpState) state;
+        _val1.selectColumns(sel, ctx, bstate.state1, true);
+        _val2.selectColumns(sel, ctx, bstate.state2, true);
     }
 
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
-        _val1.selectColumns(sel, store, params, true, fetch);
-        _val2.selectColumns(sel, store, params, true, fetch);
+    public void groupBy(Select sel, ExpContext ctx, ExpState state) {
+        sel.groupBy(newSQLBuffer(sel, ctx, state));
     }
 
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch) {
-        sel.groupBy(newSQLBuffer(sel, store, params, fetch));
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc) {
+        sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false);
     }
 
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch) {
-        sel.orderBy(newSQLBuffer(sel, store, params, fetch), asc, false);
-    }
-
-    private SQLBuffer newSQLBuffer(Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        calculateValue(sel, store, params, null, fetch);
-        SQLBuffer buf = new SQLBuffer(store.getDBDictionary());
-        appendTo(buf, 0, sel, store, params, fetch);
-        clearParameters();
+    private SQLBuffer newSQLBuffer(Select sel, ExpContext ctx, ExpState state) {
+        calculateValue(sel, ctx, state, null, null);
+        SQLBuffer buf = new SQLBuffer(ctx.store.getDBDictionary());
+        appendTo(sel, ctx, state, buf, 0);
         return buf;
     }
 
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res)
         throws SQLException {
         return Filters.convert(res.getObject(this,
             JavaSQLTypes.JDBC_DEFAULT, null), getType());
     }
 
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch) {
-        _val1.calculateValue(sel, store, params, null, fetch);
-        _val2.calculateValue(sel, store, params, null, fetch);
-    }
-
-    public void clearParameters() {
-        _val1.clearParameters();
-        _val2.clearParameters();
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState) {
+        BinaryOpExpState bstate = (BinaryOpExpState) state;
+        _val1.calculateValue(sel, ctx, bstate.state1, null, null);
+        _val2.calculateValue(sel, ctx, bstate.state2, null, null);
     }
 
-    public int length() {
+    public int length(Select sel, ExpContext ctx, ExpState state) {
         return 1;
     }
 
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
-        FilterValue str = new FilterValueImpl(_val1, sel, store, params, fetch);
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index) {
+        BinaryOpExpState bstate = (BinaryOpExpState) state;
+        FilterValue str = new FilterValueImpl(sel, ctx, bstate.state1, _val1);
         FilterValue start;
         FilterValue end = null;
         if (_val2 instanceof Args) {
-            Val[] args = ((Args) _val2).getVals();
-            start =
-                new FilterValueImpl(args[0], sel, store, params, fetch);
-            end = new FilterValueImpl(args[1], sel, store, params, fetch);
+            FilterValue[] filts = ((Args) _val2).newFilterValues(sel, ctx, 
+                bstate.state2);
+            start = filts[0];
+            end = filts[1];
         } else
-            start = new FilterValueImpl(_val2, sel, store, params, fetch);
+            start = new FilterValueImpl(sel, ctx, bstate.state2, _val2);
 
-        store.getDBDictionary().substring(sql, str, start, end);
+        ctx.store.getDBDictionary().substring(sql, str, start, end);
     }
 
     public void acceptVisit(ExpressionVisitor visitor) {

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToLowerCase.java Thu Sep  7 10:51:05 2006
@@ -15,8 +15,8 @@
  */
 package org.apache.openjpa.jdbc.kernel.exps;
 
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
 
 /**
@@ -34,16 +34,16 @@
         super(val);
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-        _val.initialize(sel, store, false);
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf, int index) {
 
-        DBDictionary dict = store.getDBDictionary();
+        DBDictionary dict = ctx.store.getDBDictionary();
         String func = dict.toLowerCaseFunction;
         dict.assertSupport(func != null, "ToLowerCaseFunction");
 
         int idx = func.indexOf("{0}");
-        _pre = func.substring(0, idx);
-        _post = func.substring(idx + 3);
+        buf.append(func.substring(0, idx));
+        getValue().appendTo(sel, ctx, state, buf, index);
+        buf.append(func.substring(idx + 3));
     }
 }
-

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ToUpperCase.java Thu Sep  7 10:51:05 2006
@@ -15,8 +15,8 @@
  */
 package org.apache.openjpa.jdbc.kernel.exps;
 
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
 
 /**
@@ -34,16 +34,17 @@
         super(val);
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-        _val.initialize(sel, store, false);
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf, int index) {
 
-        DBDictionary dict = store.getDBDictionary();
+        DBDictionary dict = ctx.store.getDBDictionary();
         String func = dict.toUpperCaseFunction;
         dict.assertSupport(func != null, "ToUpperCaseFunction");
 
         int idx = func.indexOf("{0}");
-        _pre = func.substring(0, idx);
-        _post = func.substring(idx + 3);
+        buf.append(func.substring(0, idx));
+        getValue().appendTo(sel, ctx, state, buf, index);
+        buf.append(func.substring(idx + 3));
     }
 }
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Trim.java Thu Sep  7 10:51:05 2006
@@ -18,8 +18,6 @@
 import java.lang.Math;
 import java.sql.SQLException;
 
-import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.JavaSQLTypes;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.Joins;
@@ -43,7 +41,6 @@
     private final Val _trimChar;
     private final Boolean _where;
     private ClassMetaData _meta = null;
-    private String _func = null;
 
     /**
      * Constructor. Provide the string to operate on.
@@ -62,10 +59,6 @@
         _meta = meta;
     }
 
-    public boolean isVariable() {
-        return false;
-    }
-
     public Class getType() {
         return String.class;
     }
@@ -73,119 +66,123 @@
     public void setImplicitType(Class type) {
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-        _val.initialize(sel, store, false);
-
-        DBDictionary dict = store.getDBDictionary();
-        if (_where == null) {
-            _func = dict.trimBothFunction;
-            dict.assertSupport(_func != null, "TrimBothFunction");
-        } else if (_where.equals(Boolean.TRUE)) {
-            _func = dict.trimLeadingFunction;
-            dict.assertSupport(_func != null, "TrimLeadingFunction");
-        } else if (_where.equals(Boolean.FALSE)) {
-            _func = dict.trimTrailingFunction;
-            dict.assertSupport(_func != null, "TrimTrailingFunction");
-        }
+    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
+        ExpState valueState =  _val.initialize(sel, ctx, 0);
+        ExpState charState = _trimChar.initialize(sel, ctx, 0);
+        return new TrimExpState(sel.and(valueState.joins, charState.joins), 
+            valueState, charState);
     }
 
-    public Joins getJoins() {
-        return _val.getJoins();
-    }
+    /**
+     * Expression state.
+     */
+    private static class TrimExpState
+        extends ExpState {
 
-    public Object toDataStoreValue(Object val, JDBCStore store) {
-        return val;
+        public final ExpState valueState;
+        public final ExpState charState;
+
+        public TrimExpState(Joins joins, ExpState valueState, 
+            ExpState charState) {
+            super(joins);
+            this.valueState = valueState;
+            this.charState = charState;
+        }
     }
 
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch) {
-        sel.select(newSQLBuffer(sel, store, params, fetch), this);
+    public void select(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        sel.select(newSQLBuffer(sel, ctx, state), this);
     }
 
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
-        _val.selectColumns(sel, store, params, true, fetch);
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        TrimExpState tstate = (TrimExpState) state;
+        _val.selectColumns(sel, ctx, tstate.valueState, true);
+        _trimChar.selectColumns(sel, ctx, tstate.charState, true);
     }
 
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch) {
-        sel.groupBy(newSQLBuffer(sel, store, params, fetch));
+    public void groupBy(Select sel, ExpContext ctx, ExpState state) {
+        sel.groupBy(newSQLBuffer(sel, ctx, state));
     }
 
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch) {
-        sel.orderBy(newSQLBuffer(sel, store, params, fetch), asc, false);
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc) {
+        sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false);
     }
 
-    private SQLBuffer newSQLBuffer(Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        calculateValue(sel, store, params, null, fetch);
-        SQLBuffer buf = new SQLBuffer(store.getDBDictionary());
-        appendTo(buf, 0, sel, store, params, fetch);
-        clearParameters();
+    private SQLBuffer newSQLBuffer(Select sel, ExpContext ctx, ExpState state) {
+        calculateValue(sel, ctx, state, null, null);
+        SQLBuffer buf = new SQLBuffer(ctx.store.getDBDictionary());
+        appendTo(sel, ctx, state, buf, 0);
         return buf;
     }
 
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res)
         throws SQLException {
         return Filters.convert(res.getObject(this,
             JavaSQLTypes.JDBC_DEFAULT, null), getType());
     }
 
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch) {
-        _val.calculateValue(sel, store, params, null, fetch);
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState) {
+        TrimExpState tstate = (TrimExpState) state;
+        _val.calculateValue(sel, ctx, tstate.valueState, null, null);
+        _trimChar.calculateValue(sel, ctx, tstate.charState, null, null);
     }
 
-    public void clearParameters() {
-        _val.clearParameters();
-    }
-
-    public int length() {
+    public int length(Select sel, ExpContext ctx, ExpState state) {
         return 1;
     }
 
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
-        _val.calculateValue(sel, store, params, _trimChar, fetch);
-        _trimChar.calculateValue(sel, store, params, _val, fetch);
-
-        int fromPart = _func.indexOf("{0}");
-        int charPart = _func.indexOf("{1}");
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index) {
+        DBDictionary dict = ctx.store.getDBDictionary();
+        String func;
+        if (_where == null) {
+            func = dict.trimBothFunction;
+            dict.assertSupport(func != null, "TrimBothFunction");
+        } else if (_where.booleanValue()) {
+            func = dict.trimLeadingFunction;
+            dict.assertSupport(func != null, "TrimLeadingFunction");
+        } else {
+            func = dict.trimTrailingFunction;
+            dict.assertSupport(func != null, "TrimTrailingFunction");
+        }
 
+        int fromPart = func.indexOf("{0}");
+        int charPart = func.indexOf("{1}");
         if (charPart == -1)
-            charPart = _func.length();
-
-        String part1 = _func.substring(0, Math.min(fromPart, charPart));
-
-        String part2 = _func.substring(Math.min(fromPart, charPart) + 3,
+            charPart = func.length();
+        String part1 = func.substring(0, Math.min(fromPart, charPart));
+        String part2 = func.substring(Math.min(fromPart, charPart) + 3,
             Math.max(fromPart, charPart));
-
         String part3 = null;
-        if (charPart != _func.length())
-            part3 = _func.substring(Math.max(fromPart, charPart) + 3);
+        if (charPart != func.length())
+            part3 = func.substring(Math.max(fromPart, charPart) + 3);
 
+        TrimExpState tstate = (TrimExpState) state;
         sql.append(part1);
-        (fromPart < charPart ? _val : _trimChar).
-            appendTo(sql, 0, sel, store, params, fetch);
+        if (fromPart < charPart)
+            _val.appendTo(sel, ctx, tstate.valueState, sql, 0);
+        else 
+            _trimChar.appendTo(sel, ctx, tstate.charState, sql, 0);
         sql.append(part2);
 
-        if (charPart != _func.length()) {
-            (fromPart > charPart ? _val : _trimChar).
-                appendTo(sql, 0, sel, store, params, fetch);
+        if (charPart != func.length()) {
+            if (fromPart > charPart)
+                _val.appendTo(sel, ctx, tstate.valueState, sql, 0);
+            else
+                _trimChar.appendTo(sel, ctx, tstate.charState, sql, 0);
             sql.append(part3);
         } else {
             // since the trim statement did not specify the token for
             // where to specify the trim char (denoted by "{1}"),
             // we do not have the ability to trim off non-whitespace
             // characters; throw an exception when we attempt to do so
-            if (!(_trimChar instanceof Literal)
-                || String.valueOf(((Literal) _trimChar).getValue()).
-                trim().length() != 0) {
-                store.getDBDictionary().assertSupport(false,
-                    "TrimNonWhitespaceCharacters");
-            }
+            if (!(_trimChar instanceof Const) || String.valueOf(((Const) 
+                _trimChar).getValue(ctx,tstate.charState)).trim().length() != 0)
+                dict.assertSupport(false, "TrimNonWhitespaceCharacters");
         }
     }
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/UnaryOp.java Thu Sep  7 10:51:05 2006
@@ -17,10 +17,7 @@
 
 import java.sql.SQLException;
 
-import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.meta.JavaSQLTypes;
-import org.apache.openjpa.jdbc.sql.Joins;
 import org.apache.openjpa.jdbc.sql.Result;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
@@ -47,7 +44,7 @@
         _val = val;
     }
 
-    protected Val getVal() {
+    protected Val getValue() {
         return _val;
     }
 
@@ -59,10 +56,6 @@
         _meta = meta;
     }
 
-    public boolean isVariable() {
-        return false;
-    }
-
     public Class getType() {
         if (_cast != null)
             return _cast;
@@ -73,74 +66,62 @@
         _cast = type;
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
-        _val.initialize(sel, store, false);
-    }
-
-    public Joins getJoins() {
-        return _val.getJoins();
+    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
+        return initializeValue(sel, ctx, flags);
     }
 
-    public Object toDataStoreValue(Object val, JDBCStore store) {
-        return val;
+    protected ExpState initializeValue(Select sel, ExpContext ctx, int flags) {
+        return _val.initialize(sel, ctx, flags);
     }
 
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch) {
-        sel.select(newSQLBuffer(sel, store, params, fetch), this);
+    public void select(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        sel.select(newSQLBuffer(sel, ctx, state), this);
         if (isAggregate())
             sel.setAggregate(true);
     }
 
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
-        _val.selectColumns(sel, store, params, true, fetch);
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
+        _val.selectColumns(sel, ctx, state, true);
     }
 
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch) {
-        sel.groupBy(newSQLBuffer(sel, store, params, fetch));
+    public void groupBy(Select sel, ExpContext ctx, ExpState state) {
+        sel.groupBy(newSQLBuffer(sel, ctx, state));
     }
 
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch) {
-        sel.orderBy(newSQLBuffer(sel, store, params, fetch), asc, false);
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc) {
+        sel.orderBy(newSQLBuffer(sel, ctx, state), asc, false);
     }
 
-    private SQLBuffer newSQLBuffer(Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch) {
-        calculateValue(sel, store, params, null, fetch);
-        SQLBuffer buf = new SQLBuffer(store.getDBDictionary());
-        appendTo(buf, 0, sel, store, params, fetch);
-        clearParameters();
+    private SQLBuffer newSQLBuffer(Select sel, ExpContext ctx, ExpState state) {
+        calculateValue(sel, ctx, state, null, null);
+        SQLBuffer buf = new SQLBuffer(ctx.store.getDBDictionary());
+        appendTo(sel, ctx, state, buf, 0);
         return buf;
     }
 
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res)
         throws SQLException {
         return Filters.convert(res.getObject(this,
             JavaSQLTypes.JDBC_DEFAULT, null), getType());
     }
 
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch) {
-        _val.calculateValue(sel, store, params, null, fetch);
-    }
-
-    public void clearParameters() {
-        _val.clearParameters();
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState) {
+        _val.calculateValue(sel, ctx, state, null, null);
     }
 
-    public int length() {
+    public int length(Select sel, ExpContext ctx, ExpState state) {
         return 1;
     }
 
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index) {
         sql.append(getOperator());
         sql.append("(");
-        _val.appendTo(sql, 0, sel, store, params, fetch);
+        _val.appendTo(sel, ctx, state, sql, 0);
         sql.append(")");
     }
 

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Val.java Thu Sep  7 10:51:05 2006
@@ -36,64 +36,54 @@
     extends Value {
 
     /**
-     * Initialize the value. This method should recursively initialize any
-     * sub-values. It should also cache the {@link Joins} instance
-     * containing the joins for this value. No additional joins should be
-     * made after this call. The parent expression might modify these joins
-     * during its own initialization so that common joins are moved up the
-     * expression tree. These joins should not be included in the SQL
-     * appended through any of the <code>append</code> methods.
-     *
-     * @param sel used to create {@link Joins} instances
-     * @param store the store manager for the query
-     * @param nullTest if true, then this value will be compared
-     * to null or tested for emptiness
+     * Initialization flag indicating that this value will be compared to null.
      */
-    public void initialize(Select sel, JDBCStore store, boolean nullTest);
+    public final int NULL_CMP = 1;
 
     /**
-     * Return the joins for this value. These joins should be created
-     * and cached during the {@link #initialize} method. The parent
-     * expression might modify these joins during its own initialization so
-     * that common joins are moved up the expression tree.
+     * Initialization flag indicating to join into any relation path.
      */
-    public Joins getJoins();
+    public final int JOIN_REL = 2; 
+
+    /**
+     * Initialize the value. This method should recursively initialize any
+     * sub-values. 
+     */
+    public ExpState initialize(Select sel, ExpContext ctx, int flags);
 
     /**
      * Return the datastore value of the given object in the context of this
      * value.
      */
-    public Object toDataStoreValue(Object val, JDBCStore store);
+    public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state, 
+        Object val);
 
     /**
      * Select the data for this value.
      */
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch);
+    public void select(Select sel, ExpContext ctx, ExpState state, boolean pks);
 
     /**
      * Select just the columns for this value.
      */
-    public void selectColumns(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch);
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks);
 
     /**
      * Group by this value.
      */
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch);
+    public void groupBy(Select sel, ExpContext ctx, ExpState state);
 
     /**
      * Order by this value.
      */
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch);
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc);
 
     /**
      * Load the data for this value.
      */
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res)
         throws SQLException;
 
     /**
@@ -102,55 +92,50 @@
      *
      * @param other the value being compared to, or null if not a comparison
      */
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch);
-
-    /**
-     * Clear parameter values held by this value or its subcomponents.
-     * This method is called sometime after <code>calculateValue</code>.
-     */
-    public void clearParameters();
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState);
 
     /**
      * Return the number of SQL elements in this value.
      */
-    public int length();
+    public int length(Select sel, ExpContext ctx, ExpState state);
 
     /**
      * Append the <code>index</code>th SQL element to the given buffer.
      */
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch);
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, 
+        int index);
 
     /**
      * Append the SQL testing whether this value is empty to the given buffer.
      */
-    public void appendIsEmpty(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch);
+    public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql);
 
     /**
      * Append the SQL testing whether this value is not empty to
      * the given buffer.
      */
-    public void appendIsNotEmpty(SQLBuffer sql, Select sel, JDBCStore store,
-        Object[] params, JDBCFetchConfiguration fetch);
+    public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql);
 
     /**
      * Append the SQL checking the size of this value.
      */
-    public void appendSize(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch);
+    public void appendSize(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql);
 
     /**
      * Append the SQL testing whether this value is null to the given buffer.
      */
-    public void appendIsNull(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch);
+    public void appendIsNull(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql);
 
     /**
      * Append the SQL testing whether this value is not null to the given
      * buffer.
      */
-    public void appendIsNotNull(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch);
+    public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql);
 }

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/Variable.java Thu Sep  7 10:51:05 2006
@@ -17,9 +17,6 @@
 
 import java.sql.SQLException;
 
-import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
-import org.apache.openjpa.jdbc.kernel.JDBCStore;
-import org.apache.openjpa.jdbc.sql.Joins;
 import org.apache.openjpa.jdbc.sql.Result;
 import org.apache.openjpa.jdbc.sql.SQLBuffer;
 import org.apache.openjpa.jdbc.sql.Select;
@@ -106,81 +103,66 @@
             _path.setImplicitType(type);
     }
 
-    public void initialize(Select sel, JDBCStore store, boolean nullTest) {
+    public ExpState initialize(Select sel, ExpContext ctx, int flags) {
         if (_path != null) {
             _path.addVariableAction(this);
-            _path.initialize(sel, store, nullTest);
-            _path.joinRelation();
+            return _path.initialize(sel, ctx, flags | JOIN_REL);
         }
+        return ExpState.NULL;
     }
 
-    public Joins getJoins() {
-        return (_path == null) ? null : _path.getJoins();
+    public void select(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
     }
 
-    public Object toDataStoreValue(Object val, JDBCStore store) {
-        return val;
+    public void selectColumns(Select sel, ExpContext ctx, ExpState state, 
+        boolean pks) {
     }
 
-    public void select(Select sel, JDBCStore store, Object[] params,
-        boolean pks, JDBCFetchConfiguration fetch) {
+    public void groupBy(Select sel, ExpContext ctx, ExpState state) {
     }
 
-    public void selectColumns(Select sel, JDBCStore store,
-        Object[] params, boolean pks, JDBCFetchConfiguration fetch) {
+    public void orderBy(Select sel, ExpContext ctx, ExpState state, 
+        boolean asc) {
     }
 
-    public void groupBy(Select sel, JDBCStore store, Object[] params,
-        JDBCFetchConfiguration fetch) {
-    }
-
-    public void orderBy(Select sel, JDBCStore store, Object[] params,
-        boolean asc, JDBCFetchConfiguration fetch) {
-    }
-
-    public Object load(Result res, JDBCStore store,
-        JDBCFetchConfiguration fetch)
+    public Object load(ExpContext ctx, ExpState state, Result res)
         throws SQLException {
         return null;
     }
 
-    public void calculateValue(Select sel, JDBCStore store,
-        Object[] params, Val other, JDBCFetchConfiguration fetch) {
-        if (_path != null)
-            _path.calculateValue(sel, store, params, other, fetch);
-    }
-
-    public void clearParameters() {
+    public void calculateValue(Select sel, ExpContext ctx, ExpState state, 
+        Val other, ExpState otherState) {
         if (_path != null)
-            _path.clearParameters();
+            _path.calculateValue(sel, ctx, state, other, otherState);
     }
 
-    public int length() {
+    public int length(Select sel, ExpContext ctx, ExpState state) {
         return 0;
     }
 
-    public void appendTo(SQLBuffer sql, int index, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendTo(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer sql, int index) {
     }
 
-    public void appendIsEmpty(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendIsEmpty(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf) {
     }
 
-    public void appendIsNotEmpty(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendIsNotEmpty(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf) {
     }
 
-    public void appendSize(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendSize(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf) {
     }
 
-    public void appendIsNull(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendIsNull(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf) {
     }
 
-    public void appendIsNotNull(SQLBuffer sql, Select sel,
-        JDBCStore store, Object[] params, JDBCFetchConfiguration fetch) {
+    public void appendIsNotNull(Select sel, ExpContext ctx, ExpState state, 
+        SQLBuffer buf) {
     }
 
     public void acceptVisit(ExpressionVisitor visitor) {

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Thu Sep  7 10:51:05 2006
@@ -59,6 +59,8 @@
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.kernel.JDBCStore;
+import org.apache.openjpa.jdbc.kernel.exps.ExpContext;
+import org.apache.openjpa.jdbc.kernel.exps.ExpState;
 import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
 import org.apache.openjpa.jdbc.kernel.exps.Val;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
@@ -1851,6 +1853,8 @@
 
         // manually build up the SET clause for the UPDATE statement
         sql.append(" SET ");
+        ExpContext ctx = new ExpContext(store, params, 
+            store.getFetchConfiguration());
         for (Iterator i = updateParams.entrySet().iterator(); i.hasNext();) {
             Map.Entry next = (Map.Entry) i.next();
             FieldMetaData fmd = (FieldMetaData) next.getKey();
@@ -1859,15 +1863,15 @@
             Column col = ((FieldMapping) fmd).getColumns()[0];
             sql.append(col.getName());
             sql.append(" = ");
-            val.initialize(sel, store, false);
-            JDBCFetchConfiguration fetch = store.getFetchConfiguration();
-            val.calculateValue(sel, store, params, null, fetch);
+
+            ExpState state = val.initialize(sel, ctx, 0);
+            val.calculateValue(sel, ctx, state, null, null);
 
             // append the value with a null for the Select; i
             // indicates that the
-            for (int j = 0; j < val.length(); j++)
-                val.appendTo(sql, j, (allowAlias) ? sel : null, store, params, 
-                    fetch);
+            int length = val.length(sel, ctx, state);
+            for (int j = 0; j < length; j++)
+                val.appendTo((allowAlias) ? sel : null, ctx, state, sql, j);
 
             if (i.hasNext())
                 sql.append(", ");
@@ -3607,10 +3611,7 @@
         } catch (IOException ioe) {
             throw new GeneralException(ioe);
         } finally {
-            try {
-                in.close();
-            } catch (IOException e) {
-            }
+            try { in.close(); } catch (IOException e) {}
         }
 
         // add additional reserved words set by user

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerFactory.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerFactory.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerFactory.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerFactory.java Thu Sep  7 10:51:05 2006
@@ -96,6 +96,6 @@
 
     /**
      * Release the internal lock.
-	 */
-	public void unlock ();
+     */
+    public void unlock ();
 }

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java Thu Sep  7 10:51:05 2006
@@ -628,8 +628,8 @@
         private final ExpressionParser _parser;
         private final ExpressionFactory[] _facts;
         private final QueryExpressions[] _exps;
+        private final Class[] _projTypes;
         private Value[] _inMemOrdering;
-        private Class[] _projTypes;
 
         public DataStoreExecutor(ExpressionStoreQuery q,
             ClassMetaData meta, boolean subclasses,
@@ -644,10 +644,17 @@
                 _facts[i] = q.getExpressionFactory(_metas[i]);
 
             _exps = new QueryExpressions[_metas.length];
-            for (int i = 0; i < _exps.length; i++) {
+            for (int i = 0; i < _exps.length; i++)
                 _exps[i] = parser.eval(parsed, q, _facts[i], _metas[i]);
-                for (int j = 0; j < _exps[i].projections.length; j++)
-                    assertNotContainer(_exps[i].projections[j], q);
+
+            if (_exps[0].projections.length == 0)
+                _projTypes = StoreQuery.EMPTY_CLASSES;
+            else {
+                _projTypes = new Class[_exps[0].projections.length];
+                for (int i = 0; i < _exps[0].projections.length; i++) {
+                    assertNotContainer(_exps[0].projections[i], q);
+                    _projTypes[i] = _exps[0].projections[i].getType();
+                }
             }
         }
 
@@ -706,29 +713,16 @@
                     _inMemOrdering = _parser.eval(_exps[0].orderingClauses,
                         (ExpressionStoreQuery) q, factory, _meta);
                 }
-
-                // use the parsed ordering expression to extract the ordering
-                // value
-                Val val = (Val) _inMemOrdering[orderIndex];
-                return val.evaluate(resultObject, resultObject,
-                    q.getContext().getStoreContext(), params);
             }
+
+            // use the parsed ordering expression to extract the ordering value
+            Val val = (Val) _inMemOrdering[orderIndex];
+            return val.evaluate(resultObject, resultObject,
+                q.getContext().getStoreContext(), params);
         }
 
         public Class[] getProjectionTypes(StoreQuery q) {
-            if (_exps[0].projections.length == 0)
-                return StoreQuery.EMPTY_CLASSES;
-
-            synchronized (this) {
-                if (_projTypes == null) {
-                    // delay creating this array until it is requested b/c
-                    // before execution the types might not be initialized
-                    _projTypes = new Class[_exps[0].projections.length];
-                    for (int i = 0; i < _exps[0].projections.length; i++)
-                        _projTypes[i] = _exps[0].projections[i].getType();
-				}
-				return _projTypes;
-			}
+            return _projTypes;
 		}
 	}
 }

Modified: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlan.java Thu Sep  7 10:51:05 2006
@@ -15,15 +15,10 @@
  */
 package org.apache.openjpa.persistence.jdbc;
 
-import org.apache.openjpa.jdbc.kernel.DelegatingJDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
-import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.kernel.LRSSizes;
 import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
-import org.apache.openjpa.kernel.DelegatingFetchConfiguration;
-import org.apache.openjpa.kernel.FetchConfiguration;
 import org.apache.openjpa.persistence.FetchPlan;
-import org.apache.openjpa.persistence.PersistenceExceptions;
 
 /**
  * JDBC extensions to the fetch plan.
@@ -36,27 +31,87 @@
 public interface JDBCFetchPlan
     extends FetchPlan, EagerFetchModes, LRSSizes, JoinSyntaxes {
 
+    /**
+     * Eager fetch mode in loading relations.
+     * 
+     * @see EagerFetchModes
+     */
     public int getEagerFetchMode();
 
+    /**
+     * Eager fetch mode in loading relations.
+     * 
+     * @see EagerFetchModes
+     */
     public JDBCFetchPlan setEagerFetchMode(int mode);
 
+    /**
+     * Eager fetch mode in loading subclasses.
+     * 
+     * @see EagerFetchModes
+     */
     public int getSubclassFetchMode();
 
+    /**
+     * Eager fetch mode in loading subclasses.
+     * 
+     * @see EagerFetchModes
+     */
     public JDBCFetchPlan setSubclassFetchMode(int mode);
 
+    /**
+     * Type of JDBC result set to use for query results.
+     * 
+     * @see java.sql.ResultSet
+     */
     public int getResultSetType();
 
+    /**
+     * Type of JDBC result set to use for query results.
+     * 
+     * @see java.sql.ResultSet
+     */
     public JDBCFetchPlan setResultSetType(int type);
 
+    /**
+     * Result set fetch direction.
+     * 
+     * @see java.sql.ResultSet
+     */
     public int getFetchDirection();
 
+    /**
+     * Result set fetch direction.
+     * 
+     * @see java.sql.ResultSet
+     */
     public JDBCFetchPlan setFetchDirection(int direction);
 
+    /**
+     * How to determine the size of a large result set.
+     * 
+     * @see LRSSizes
+     */
     public int getLRSSize();
 
+    /**
+     * How to determine the size of a large result set.
+     * 
+     * @see LRSSizes
+     */
     public JDBCFetchPlan setLRSSize(int lrsSize);
 
+    /**
+     * SQL join syntax.
+     *
+     * @see JoinSyntaxes
+     */
     public int getJoinSyntax();
 
+    /**
+     * SQL join syntax.
+     *
+     * @see JoinSyntaxes
+     */
     public JDBCFetchPlan setJoinSyntax(int syntax);
 }

Modified: incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java Thu Sep  7 10:51:05 2006
@@ -31,7 +31,6 @@
  *
  * @since 0.4.0
  * @author Abe White
- * @published
  */
 public class JDBCFetchPlanImpl
     extends FetchPlanImpl

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Extent.java Thu Sep  7 10:51:05 2006
@@ -15,22 +15,17 @@
  */
 package org.apache.openjpa.persistence;
 
-import java.util.Iterator;
 import java.util.List;
 
-import org.apache.openjpa.kernel.DelegatingExtent;
-
 /**
  * An extent is a logical view of all instances of a class.
  *
  * @author Abe White
- * @author Pinaki Poddar
  * @since 0.4.0
  * @published
  */
 public interface Extent<T>
     extends Iterable<T> {
-
 
     /**
      * Delegate.

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ExtentImpl.java Thu Sep  7 10:51:05 2006
@@ -24,7 +24,6 @@
  * An extent is a logical view of all instances of a class.
  *
  * @author Abe White
- * @author Pinaki Poddar
  * @since 0.4.1
  * @nojavadoc
  */
@@ -34,7 +33,6 @@
     private final EntityManagerImpl _em;
     private final DelegatingExtent _extent;
     private FetchPlan _fetch = null;
-
 
     /**
      * Constructor; supply delegate.

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlan.java Thu Sep  7 10:51:05 2006
@@ -15,13 +15,9 @@
  */
 package org.apache.openjpa.persistence;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import javax.persistence.LockModeType;
 
-import org.apache.openjpa.kernel.DelegatingFetchConfiguration;
 import org.apache.openjpa.kernel.FetchConfiguration;
 import org.apache.openjpa.meta.FetchGroup;
 
@@ -120,6 +116,7 @@
      * use when loading objects.
      */
     public FetchPlan addFetchGroups(String... groups);
+
     /**
      * Adds <code>groups</code> to the set of fetch group names to
      * use when loading objects.

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanImpl.java Thu Sep  7 10:51:05 2006
@@ -23,7 +23,6 @@
 
 import org.apache.openjpa.kernel.DelegatingFetchConfiguration;
 import org.apache.openjpa.kernel.FetchConfiguration;
-import org.apache.openjpa.meta.FetchGroup;
 
 /**
  * Implements FetchPlan via delegation to FetchConfiguration.
@@ -62,280 +61,148 @@
         return _fetch.getDelegate();
     }
 
-    /**
-     * The maximum fetch depth when loading an object.
-     */
     public int getMaxFetchDepth() {
         return _fetch.getMaxFetchDepth();
     }
 
-    /**
-     * The maximum fetch depth when loading an object.
-     */
     public FetchPlan setMaxFetchDepth(int depth) {
         _fetch.setMaxFetchDepth(depth);
         return this;
     }
 
-    /**
-     * Return the fetch batch size for large result set support.
-     * Defaults to the	<code>openjpa.FetchBatchSize</code> setting. Note
-     * that this property will be ignored under some data stores.
-     */
     public int getFetchBatchSize() {
         return _fetch.getFetchBatchSize();
     }
 
-    /**
-     * Set the fetch batch size for large result set support.
-     * Defaults to the	<code>openjpa.FetchBatchSize</code> setting. Note
-     * that this property will be ignored under some data stores.
-     */
     public FetchPlan setFetchBatchSize(int fetchBatchSize) {
         _fetch.setFetchBatchSize(fetchBatchSize);
         return this;
     }
 
-    /**
-     * Return whether or not query caching is enabled. If this returns
-     * <code>true</code> but the datacache plugin is not installed, caching
-     * will not be enabled. If this
-     * returns <code>false</code>, query caching will not be used
-     * even if the datacache plugin is installed.
-     */
     public boolean getQueryResultCache() {
         return _fetch.getQueryCache();
     }
 
-    /**
-     * Control whether or not query caching is enabled. This has no effect
-     * if the datacache plugin is not installed, or if the query cache size
-     * is set to zero.
-     */
     public FetchPlan setQueryResultCache(boolean cache) {
         _fetch.setQueryCache(cache);
         return this;
     }
 
-    /**
-     * Returns the names of the fetch groups that this component will use
-     * when loading objects. Defaults to the
-     * <code>org.apache.openjpa.FetchGroups</code> setting.
-     */
     public Collection<String> getFetchGroups() {
         return _fetch.getFetchGroups();
     }
 
-    /**
-     * Adds <code>group</code> to the set of fetch group to
-     * use when loading objects.
-     */
     public FetchPlan addFetchGroup(String group) {
         _fetch.addFetchGroup(group);
         return this;
     }
 
-    /**
-     * Adds <code>groups</code> to the set of fetch group names to
-     * use when loading objects.
-     */
     public FetchPlan addFetchGroups(String... groups) {
         return addFetchGroups(Arrays.asList(groups));
     }
 
-    /**
-     * Adds <code>groups</code> to the set of fetch group names to
-     * use when loading objects.
-     */
     public FetchPlan addFetchGroups(Collection groups) {
         _fetch.addFetchGroups(groups);
         return this;
     }
 
-    /**
-     * Remove the given fetch group.
-     */
     public FetchPlan removeFetchGroup(String group) {
         _fetch.removeFetchGroup(group);
         return this;
     }
 
-    /**
-     * Removes <code>groups</code> from the set of fetch group names
-     * to use when loading objects.
-     */
     public FetchPlan removeFetchGroups(String... groups) {
         return removeFetchGroups(Arrays.asList(groups));
     }
 
-    /**
-     * Removes <code>groups</code> from the set of fetch group names
-     * to use when loading objects.
-     */
     public FetchPlan removeFetchGroups(Collection groups) {
         _fetch.removeFetchGroups(groups);
         return this;
     }
 
-    /**
-     * Clears the set of fetch group names to use wen loading
-     * data. After this operation is invoked, only those fields in
-     * the default fetch group (and any requested field) will be
-     * loaded when loading an object.
-     */
     public FetchPlan clearFetchGroups() {
         _fetch.clearFetchGroups();
         return this;
     }
 
-    /**
-     * Resets the set of fetch groups to the list in the global configuration.
-     */
     public FetchPlan resetFetchGroups() {
         _fetch.resetFetchGroups();
         return this;
     }
 
-    /**
-     * Returns the fully qualified names of the fields that this component
-     * will use when loading objects. Defaults to the empty set.
-     */
     public Collection<String> getFields() {
         return (Collection<String>) _fetch.getFields();
     }
 
-    /**
-     * Return true if the given field has been added.
-     */
     public boolean hasField(String field) {
         return _fetch.hasField(field);
     }
 
-    /**
-     * Return true if the given field has been added.
-     */
     public boolean hasField(Class cls, String field) {
         return hasField(toFieldName(cls, field));
     }
 
-    /**
-     * Adds <code>field</code> to the set of fully-qualified field names to
-     * use when loading objects.
-     */
     public FetchPlan addField(String field) {
         _fetch.addField(field);
         return this;
     }
 
-    /**
-     * Adds <code>field</code> to the set of field names to
-     * use when loading objects.
-     */
     public FetchPlan addField(Class cls, String field) {
         return addField(toFieldName(cls, field));
     }
 
-    /**
-     * Adds <code>fields</code> to the set of fully-qualified field names to
-     * use when loading objects.
-     */
     public FetchPlan addFields(String... fields) {
         return addFields(Arrays.asList(fields));
     }
 
-    /**
-     * Adds <code>fields</code> to the set of field names to
-     * use when loading objects.
-     */
     public FetchPlan addFields(Class cls, String... fields) {
         return addFields(cls, Arrays.asList(fields));
     }
 
-    /**
-     * Adds <code>fields</code> to the set of fully-qualified field names to
-     * use when loading objects.
-     */
     public FetchPlan addFields(Collection fields) {
         _fetch.addFields(fields);
         return this;
     }
 
-    /**
-     * Adds <code>fields</code> to the set of field names to
-     * use when loading objects.
-     */
     public FetchPlan addFields(Class cls, Collection fields) {
         return addFields(toFieldNames(cls, fields));
     }
 
-    /**
-     * Remove the given fully-qualified field.
-     */
     public FetchPlan removeField(String field) {
         _fetch.removeField(field);
         return this;
     }
 
-    /**
-     * Remove the given field.
-     */
     public FetchPlan removeField(Class cls, String field) {
         return removeField(toFieldName(cls, field));
     }
 
-    /**
-     * Removes <code>fields</code> from the set of fully-qualified field names
-     * to use when loading objects.
-     */
     public FetchPlan removeFields(String... fields) {
         return removeFields(Arrays.asList(fields));
     }
 
-    /**
-     * Removes <code>fields</code> from the set of field names
-     * to use when loading objects.
-     */
     public FetchPlan removeFields(Class cls, String... fields) {
         return removeFields(cls, Arrays.asList(fields));
     }
 
-    /**
-     * Removes <code>fields</code> from the set of fully-qualified field names
-     * to use when loading objects.
-     */
     public FetchPlan removeFields(Collection fields) {
         _fetch.removeFields(fields);
         return this;
     }
 
-    /**
-     * Removes <code>fields</code> from the set of field names
-     * to use when loading objects.
-     */
     public FetchPlan removeFields(Class cls, Collection fields) {
         return removeFields(toFieldNames(cls, fields));
     }
 
-    /**
-     * Clears the set of field names to use wen loading
-     * data. After this operation is invoked, only those fields in
-     * the configured fetch groups will be loaded when loading an object.
-     */
     public FetchPlan clearFields() {
         _fetch.clearFields();
         return this;
     }
 
-    /**
-     * Combine the class and field to a fully-qualified field name.
-     */
     private static String toFieldName(Class cls, String field) {
         return cls.getName() + "." + field;
     }
 
-    /**
-     * Combine the class and fields to fully-qualified field names.
-     */
     private static Collection toFieldNames(Class cls, Collection fields) {
         if (fields.isEmpty())
             return fields;
@@ -345,48 +212,28 @@
         return names;
     }
 
-    /**
-     * The number of milliseconds to wait for an object lock, or -1 for no
-     * limit.
-     */
     public int getLockTimeout() {
         return _fetch.getLockTimeout();
     }
 
-    /**
-     * The number of milliseconds to wait for an object lock, or -1 for no
-     * limit.
-     */
     public FetchPlan setLockTimeout(int timeout) {
         _fetch.setLockTimeout(timeout);
         return this;
     }
 
-    /**
-     * The lock level to use for locking loaded objects.
-     */
     public LockModeType getReadLockMode() {
         return EntityManagerImpl.fromLockLevel(_fetch.getReadLockLevel());
     }
 
-    /**
-     * The lock level to use for locking loaded objects.
-     */
     public FetchPlan setReadLockMode(LockModeType mode) {
         _fetch.setReadLockLevel(EntityManagerImpl.toLockLevel(mode));
         return this;
     }
 
-    /**
-     * The lock level to use for locking dirtied objects.
-     */
     public LockModeType getWriteLockMode() {
         return EntityManagerImpl.fromLockLevel(_fetch.getWriteLockLevel());
     }
 
-    /**
-     * The lock level to use for locking dirtied objects.
-     */
     public FetchPlan setWriteLockMode(LockModeType mode) {
         _fetch.setWriteLockLevel(EntityManagerImpl.toLockLevel(mode));
         return this;

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/Generator.java Thu Sep  7 10:51:05 2006
@@ -15,16 +15,12 @@
  */
 package org.apache.openjpa.persistence;
 
-import org.apache.openjpa.kernel.DelegatingSeq;
 import org.apache.openjpa.kernel.Seq;
-import org.apache.openjpa.kernel.StoreContext;
-import org.apache.openjpa.meta.ClassMetaData;
 
 /**
  * Represents a store sequence.
  *
  * @author Abe White
- * @author Pinaki Poddar
  * @since 0.4.1
  * @published
  */

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/GeneratorImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/GeneratorImpl.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/GeneratorImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/GeneratorImpl.java Thu Sep  7 10:51:05 2006
@@ -24,7 +24,6 @@
  * Represents a store sequence.
  *
  * @author Abe White
- * @author Pinaki Poddar
  * @since 0.4.1
  * @nojavadoc
  */

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAPersistence.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAPersistence.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAPersistence.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAPersistence.java Thu Sep  7 10:51:05 2006
@@ -152,8 +152,7 @@
     public static OpenJPAEntityManager cast(EntityManager em) {
         if (em instanceof OpenJPAEntityManager)
             return (OpenJPAEntityManager) em;
-        else
-            return (OpenJPAEntityManager) em.getDelegate();
+        return (OpenJPAEntityManager) em.getDelegate();
     }
 
     /**
@@ -181,8 +180,7 @@
     public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map) {
         ConfigurationProvider cp = new MapConfigurationProvider(map);
         try {
-            return toEntityManagerFactory(Bootstrap.getBrokerFactory
-                (cp, null));
+            return toEntityManagerFactory(Bootstrap.getBrokerFactory(cp, null));
         } catch (Exception e) {
             throw PersistenceExceptions.toPersistenceException(e);
         }
@@ -257,8 +255,7 @@
             if (o instanceof PersistenceCapable)
                 return toEntityManager((Broker) ((PersistenceCapable) o).
                     pcGetGenericContext());
-            else
-                return null;
+            return null;
         } catch (Exception e) {
             throw PersistenceExceptions.toPersistenceException(e);
         }

Modified: incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderExtension.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderExtension.java?view=diff&rev=441158&r1=441157&r2=441158
==============================================================================
--- incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderExtension.java (original)
+++ incubator/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderExtension.java Thu Sep  7 10:51:05 2006
@@ -11,16 +11,14 @@
  * @nojavadoc
  */
 public interface PersistenceProviderExtension {
+
 	/**
 	 * Gets the Configuration Provider implementation for this receiver.
-	 * 
 	 */
 	public ConfigurationProviderImpl newConfigurationProviderImpl();
 	
 	/**
 	 * Gets the EntityManagerFactory given a Broker Factory.
-	 * @param factory
-
 	 */
 	public OpenJPAEntityManagerFactory toEntityManagerFactory(BrokerFactory 
 		factory);



Mime
View raw message