Author: jonesde
Date: Sat Apr 14 06:01:51 2007 New Revision: 528801 URL: http://svn.apache.org/viewvc?view=rev&rev=528801 Log: A fairly dramatic change required because the DatasourceInfo stuff was being mostly ignored for most of the sql generation code, especially in the view entity stuff; fixing this resulted in a problem with derby requiring adding the alias-view-columns=false attribute to the datasource element in the entityengine.xml file; in any case, the somewhat tricky and funny but useful option of using a view-entity in a sub-select is now working properly Modified: ofbiz/trunk/framework/entity/config/entityengine.xml ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Modified: ofbiz/trunk/framework/entity/config/entityengine.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/config/entityengine.xml (original) +++ ofbiz/trunk/framework/entity/config/entityengine.xml Sat Apr 14 06:01:51 2007 @@ -139,7 +139,8 @@ field-type-name="derby" check-on-start="true" add-missing-on-start="true" - use-pk-constraint-names="false"> + use-pk-constraint-names="false" + alias-view-columns="false"> <read-data reader-name="seed"/> <read-data reader-name="demo"/> <read-data reader-name="ext"/> @@ -159,7 +160,8 @@ field-type-name="derby" check-on-start="true" add-missing-on-start="true" - use-pk-constraint-names="false"> + use-pk-constraint-names="false" + alias-view-columns="false"> <inline-jdbc jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver" jdbc-uri="jdbc:derby:ofbizodbc;create=true" Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java Sat Apr 14 06:01:51 2007 @@ -34,6 +34,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; @@ -82,7 +83,7 @@ visitor.accept(rhs); } - public void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, boolean compat, Object lhs, Object rhs) { + public void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { //Debug.logInfo("EntityComparisonOperator.addSqlValue field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module); // if this is an IN operator and the rhs Object isEmpty, add "FALSE" instead of the normal SQL @@ -94,7 +95,7 @@ ModelField field; if (lhs instanceof EntityConditionValue) { EntityConditionValue ecv = (EntityConditionValue) lhs; - ecv.addSqlValue(sql, entity, entityConditionParams, false, null); + ecv.addSqlValue(sql, entity, entityConditionParams, false, datasourceInfo); field = ecv.getModelField(entity); } else if (compat && lhs instanceof String) { field = getField(entity, (String) lhs); @@ -108,18 +109,18 @@ field = null; } - makeRHSWhereString(entity, entityConditionParams, sql, field, rhs); + makeRHSWhereString(entity, entityConditionParams, sql, field, rhs, datasourceInfo); } - protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sql, ModelField field, Object rhs) { + protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sql, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { sql.append(' ').append(getCode()).append(' '); - makeRHSWhereStringValue(entity, entityConditionParams, sql, field, rhs); + makeRHSWhereStringValue(entity, entityConditionParams, sql, field, rhs, datasourceInfo); } - protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuffer sql, ModelField field, Object rhs) { + protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuffer sql, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { if (rhs instanceof EntityConditionValue) { EntityConditionValue ecv = (EntityConditionValue) rhs; - ecv.addSqlValue(sql, entity, entityConditionParams, false, null); + ecv.addSqlValue(sql, entity, entityConditionParams, false, datasourceInfo); } else { addValue(sql, field, rhs, entityConditionParams); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java Sat Apr 14 06:01:51 2007 @@ -22,9 +22,12 @@ import java.util.List; import java.util.Map; +import javolution.util.FastList; + import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericModelException; import org.ofbiz.entity.GenericEntity; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; /** @@ -41,14 +44,14 @@ public abstract class EntityCondition extends EntityConditionBase { public String toString() { - return makeWhereString(null, new ArrayList()); + return makeWhereString(null, FastList.newInstance(), null); } public void accept(EntityConditionVisitor visitor) { throw new IllegalArgumentException(getClass().getName() + ".accept not implemented"); } - abstract public String makeWhereString(ModelEntity modelEntity, List entityConditionParams); + abstract public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo); abstract public void checkCondition(ModelEntity modelEntity) throws GenericModelException; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java Sat Apr 14 06:01:51 2007 @@ -24,6 +24,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; /** @@ -84,10 +85,10 @@ return idInt ^ condition.hashCode(); } - public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { + public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { StringBuffer sb = new StringBuffer(); sb.append(codeString).append('('); - sb.append(condition.makeWhereString(modelEntity, entityConditionParams)); + sb.append(condition.makeWhereString(modelEntity, entityConditionParams, datasourceInfo)); sb.append(')'); return sb.toString(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java Sat Apr 14 06:01:51 2007 @@ -24,6 +24,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; /** @@ -63,10 +64,10 @@ visitor.acceptEntityJoinOperator(operator, conditionList); } - public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { + public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module); StringBuffer sql = new StringBuffer(); - operator.addSqlValue(sql, modelEntity, entityConditionParams, conditionList); + operator.addSqlValue(sql, modelEntity, entityConditionParams, conditionList, datasourceInfo); return sql.toString(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java Sat Apr 14 06:01:51 2007 @@ -29,6 +29,7 @@ import org.ofbiz.entity.jdbc.SqlJdbcUtil; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; +import org.ofbiz.entity.model.ModelViewEntity; public class EntityConditionSubSelect extends EntityConditionValue { public static final String module = EntityConditionSubSelect.class.getName(); @@ -52,6 +53,9 @@ public void addSqlValue(StringBuffer sql, Map tableAliases, ModelEntity parentModelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceInfo) { + if (localModelEntity instanceof ModelViewEntity && datasourceInfo == null) { + throw new IllegalArgumentException("Call to EntityConditionSubSelect.addSqlValue with datasourceInfo=null which is not allowed because the local entity [" + this.localModelEntity.getEntityName() + "] is a view entity"); + } try { // add select and where and such, based on local entity not on the main entity ModelField localModelField = localModelEntity.getField(this.keyFieldName); @@ -72,7 +76,7 @@ StringBuffer whereString = new StringBuffer(); String entityCondWhereString = ""; if (this.whereCond != null) { - entityCondWhereString = this.whereCond.makeWhereString(localModelEntity, entityConditionParams); + entityCondWhereString = this.whereCond.makeWhereString(localModelEntity, entityConditionParams, datasourceInfo); } String viewClause = SqlJdbcUtil.makeViewWhereClause(localModelEntity, (datasourceInfo != null ? datasourceInfo.joinStyle : null)); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java Sat Apr 14 06:01:51 2007 @@ -25,6 +25,7 @@ import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; public class EntityDateFilterCondition extends EntityCondition { @@ -37,9 +38,9 @@ this.thruDateName = thruDateName; } - public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { + public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { EntityCondition condition = makeCondition(); - return condition.makeWhereString(modelEntity, entityConditionParams); + return condition.makeWhereString(modelEntity, entityConditionParams, datasourceInfo); } public void checkCondition(ModelEntity modelEntity) throws GenericModelException { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Sat Apr 14 06:01:51 2007 @@ -27,6 +27,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; @@ -143,10 +144,10 @@ return rhs; } - public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { + public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module); StringBuffer sql = new StringBuffer(); - operator.addSqlValue(sql, modelEntity, entityConditionParams, true, lhs, rhs); + operator.addSqlValue(sql, modelEntity, entityConditionParams, true, lhs, rhs, datasourceInfo); return sql.toString(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java Sat Apr 14 06:01:51 2007 @@ -27,6 +27,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; /** @@ -42,32 +43,32 @@ this.shortCircuitValue = shortCircuitValue; } - public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, boolean compat, Object lhs, Object rhs) { + public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { sql.append('('); - sql.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams)); + sql.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams, datasourceInfo)); sql.append(' '); sql.append(getCode()); sql.append(' '); if (rhs instanceof EntityCondition) { - sql.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams)); + sql.append(((EntityCondition) rhs).makeWhereString(modelEntity, entityConditionParams, datasourceInfo)); } else { addValue(sql, null, rhs, entityConditionParams); } sql.append(')'); } - public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, List conditionList) { + public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, List conditionList, DatasourceInfo datasourceInfo) { if (conditionList != null && conditionList.size() > 0) { sql.append('('); Iterator conditionIter = conditionList.iterator(); while (conditionIter.hasNext()) { EntityCondition condition = (EntityCondition) conditionIter.next(); - sql.append(condition.makeWhereString(modelEntity, entityConditionParams)); - if (conditionIter.hasNext()) { - sql.append(' '); - sql.append(getCode()); - sql.append(' '); - } + sql.append(condition.makeWhereString(modelEntity, entityConditionParams, datasourceInfo)); + if (conditionIter.hasNext()) { + sql.append(' '); + sql.append(getCode()); + sql.append(' '); + } } sql.append(')'); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java Sat Apr 14 06:01:51 2007 @@ -28,6 +28,7 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; @@ -78,24 +79,24 @@ public static final EntityComparisonOperator EQUALS = new EntityComparisonOperator(ID_EQUALS, "=") { public boolean compare(Object lhs, Object rhs) { return EntityComparisonOperator.compareEqual(lhs, rhs); } - protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs) { + protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { if (rhs == null || rhs == GenericEntity.NULL_FIELD) { //Debug.logInfo("makeRHSWhereString: field IS NULL: " + field.getName(), module); sb.append(" IS NULL"); } else { //Debug.logInfo("makeRHSWhereString: field not null, doing super: " + field.getName() + ", type: " + rhs.getClass().getName() + ", value: " + rhs, module); - super.makeRHSWhereString(entity, entityConditionParams, sb, field, rhs); + super.makeRHSWhereString(entity, entityConditionParams, sb, field, rhs, datasourceInfo); } } }; static { register( "equals", EQUALS ); } public static final EntityComparisonOperator NOT_EQUAL = new EntityComparisonOperator(ID_NOT_EQUAL, "<>") { public boolean compare(Object lhs, Object rhs) { return EntityComparisonOperator.compareNotEqual(lhs, rhs); } - protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs) { + protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { if (rhs == null || rhs == GenericEntity.NULL_FIELD) { sb.append(" IS NOT NULL"); } else { - super.makeRHSWhereString(entity, entityConditionParams, sb, field, rhs); + super.makeRHSWhereString(entity, entityConditionParams, sb, field, rhs, datasourceInfo); } } }; @@ -216,11 +217,11 @@ public abstract boolean mapMatches(GenericDelegator delegator, Map map, Object lhs, Object rhs); public abstract void validateSql(ModelEntity entity, Object lhs, Object rhs) throws GenericModelException; - public void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, Object lhs, Object rhs) { - addSqlValue(sql, entity, entityConditionParams, true, lhs, rhs); + public void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { + addSqlValue(sql, entity, entityConditionParams, true, lhs, rhs, datasourceInfo); } - public abstract void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, boolean compat, Object rhs, Object lhs); + public abstract void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, boolean compat, Object rhs, Object lhs, DatasourceInfo datasourceInfo); public abstract EntityCondition freeze(Object lhs, Object rhs); public abstract void visit(EntityConditionVisitor visitor, Object lhs, Object rhs); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java Sat Apr 14 06:01:51 2007 @@ -22,8 +22,9 @@ import java.util.Map; import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.GenericModelException; import org.ofbiz.entity.GenericEntity; +import org.ofbiz.entity.GenericModelException; +import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.model.ModelEntity; /** @@ -47,7 +48,7 @@ this.sqlString = sqlString; } - public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { + public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { return sqlString; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?view=diff&rev=528801&r1=528800&r2=528801 ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sat Apr 14 06:01:51 2007 @@ -319,7 +319,7 @@ fieldList.add(field); } } - sql += " WHERE " + condition.makeWhereString(modelEntity, null); + sql += " WHERE " + condition.makeWhereString(modelEntity, null, this.datasourceInfo); try { sqlP.prepareStatement(sql); @@ -684,7 +684,7 @@ String entityCondWhereString = ""; List whereEntityConditionParams = FastList.newInstance(); if (whereEntityCondition != null) { - entityCondWhereString = whereEntityCondition.makeWhereString(modelEntity, whereEntityConditionParams); + entityCondWhereString = whereEntityCondition.makeWhereString(modelEntity, whereEntityConditionParams, this.datasourceInfo); } String viewClause = SqlJdbcUtil.makeViewWhereClause(modelEntity, datasourceInfo.joinStyle); @@ -722,7 +722,7 @@ List havingEntityConditionParams = FastList.newInstance(); if (havingEntityCondition != null) { - entityCondHavingString = havingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams); + entityCondHavingString = havingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams, this.datasourceInfo); } if (entityCondHavingString.length() > 0) { sqlBuffer.append(" HAVING "); @@ -920,7 +920,7 @@ String entityCondWhereString = ""; List whereEntityConditionParams = FastList.newInstance(); if (whereEntityCondition != null) { - entityCondWhereString = whereEntityCondition.makeWhereString(modelEntity, whereEntityConditionParams); + entityCondWhereString = whereEntityCondition.makeWhereString(modelEntity, whereEntityConditionParams, this.datasourceInfo); } String viewClause = SqlJdbcUtil.makeViewWhereClause(modelEntity, datasourceInfo.joinStyle); @@ -957,7 +957,7 @@ String entityCondHavingString = ""; List havingEntityConditionParams = FastList.newInstance(); if (havingEntityCondition != null) { - entityCondHavingString = havingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams); + entityCondHavingString = havingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams, this.datasourceInfo); } if (entityCondHavingString.length() > 0) { sqlBuffer.append(" HAVING "); @@ -1067,9 +1067,9 @@ throw new org.ofbiz.entity.GenericNotImplementedException("Operation deleteByCondition not supported yet for view entities"); } - String sql = "DELETE FROM " + modelEntity.getTableName(datasourceInfo); + String sql = "DELETE FROM " + modelEntity.getTableName(this.datasourceInfo); - sql += " WHERE " + condition.makeWhereString(modelEntity, null); + sql += " WHERE " + condition.makeWhereString(modelEntity, null, this.datasourceInfo); try { sqlP.prepareStatement(sql); |
Free forum by Nabble | Edit this page |