Author: hansbak
Date: Wed Jan 30 19:59:59 2008
New Revision: 616995

URL: http://svn.apache.org/viewvc?rev=616995&view=rev
Log:
Entity sync did not work for deletes because the timestamps of the deleted 
record where also checked to be the same as the original record, this however 
was never true, even not after the copy of the complete database. Now the 
deleted record is only checked for the primary key.

Modified:
    
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java

Modified: 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java?rev=616995&r1=616994&r2=616995&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
 (original)
+++ 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
 Wed Jan 30 19:59:59 2008
@@ -216,8 +216,12 @@
                 
                 // check to see if it exists, if so remove and count, if not 
just count already removed
                 // always do a removeByAnd, if it was a removeByAnd great, if 
it was a removeByPrimaryKey, this will also work and save us a query
+                // however....removeByAnd also checks for the 
updateTimestamps....and they never match....so i changed it to remove primary 
key and only check for the primary key.....(hansbak)
                 pkToRemove.setIsFromEntitySync(true);
-                int numRemByAnd = 
delegator.removeByAnd(pkToRemove.getEntityName(), pkToRemove);
+                
+                // Debug.logInfo("try to remove: " + 
pkToRemove.getEntityName() + " key: " + pkToRemove.getPrimaryKey(), module);
+                
+                int numRemByAnd = 
delegator.removeByPrimaryKey(pkToRemove.getPrimaryKey());
                 if (numRemByAnd == 0) {
                     toRemoveAlreadyDeleted++;
                 } else {
@@ -234,6 +238,7 @@
             result.put("toStoreNotUpdated", new Long(toStoreNotUpdated));
             result.put("toRemoveDeleted", new Long(toRemoveDeleted));
             result.put("toRemoveAlreadyDeleted", new 
Long(toRemoveAlreadyDeleted));
+            if (Debug.infoOn()) Debug.logInfo("Finisching storeEntitySyncData 
(" + entitySyncId + ") - [" + keysToRemove.size() + "] to remove. Actually 
removed: " + toRemoveDeleted  + " already removed: " + toRemoveAlreadyDeleted, 
module);
             return result;
         } catch (GenericEntityException e) {
             String errorMsg = "Exception saving Entity Sync Data for 
entitySyncId [" + entitySyncId + "]: " + e.toString();


Reply via email to