Author: chrisg
Date: Wed Dec 17 02:52:06 2008
New Revision: 727342

URL: http://svn.apache.org/viewvc?rev=727342&view=rev
Log:
Fix for delegator.removeByAnd(entityName) 
(it failed because of empty where condition)
Submitted by Marco Ruocco
See OFBIZ-1952

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

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?rev=727342&r1=727341&r2=727342&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java 
(original)
+++ 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java 
Wed Dec 17 02:52:06 2008
@@ -1069,7 +1069,10 @@
 
         String sql = "DELETE FROM " + 
modelEntity.getTableName(this.datasourceInfo);
 
-        sql += " WHERE " + condition.makeWhereString(modelEntity, null, 
this.datasourceInfo);
+        String whereCondition = condition.makeWhereString(modelEntity, null, 
this.datasourceInfo);
+        if (UtilValidate.isNotEmpty(whereCondition)) {
+            sql += " WHERE " + whereCondition;
+        }
 
         try {
             sqlP.prepareStatement(sql);


Reply via email to