diff --git a/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/DeploymentEntityManager.java b/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/DeploymentEntityManager.java
index <HASH>..<HASH> 100644
--- a/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/DeploymentEntityManager.java
+++ b/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/DeploymentEntityManager.java
@@ -102,7 +102,7 @@ public class DeploymentEntityManager extends AbstractManager {
 
         long nrOfProcessDefinitionsWithSameKey = 0;
         for (ProcessDefinition p : processDefinitions) {
-          if (!p.getId().equals(processDefinition) && p.getKey().equals(processDefinition)) {
+          if (!p.getId().equals(processDefinition.getId()) && p.getKey().equals(processDefinition.getKey())) {
             nrOfProcessDefinitionsWithSameKey++;
           }
         }
Applied patch ACT-<I>