The conditions you use are checking to see if the objects are the same, not if they have change.
To see if they have changed, use the Java actions ObjectHasChanged and or MemberHasChanged. These Java actions can be found in Community Commons.
Hope that helps,
Based on your first sentence what you are looking for is this:
Retrieve entity from database where
[id != $entity] //So another object of the same entity in your database (is your entity a singleton?)
In addition you might want to check some other attribute to conclude if this is a possible duplicate, so add an extra xpath constraint:
[attribute1 = $entity/attribute1] //So this checks if you already have an object in database with something like same name, or ‘Active = true’ or whatever you would like to compare.