Actually even if an object is marked as dirty after ‘setXyz’, later on during 
commit Cayenne should do a proper comparison and avoid “phantom” commits. The 
relevant code is in org.apache.cayenne.access.ObjectDiff.isNoop:

https://github.com/apache/cayenne/blob/master/cayenne-server/src/main/java/org/apache/cayenne/access/ObjectDiff.java

Andrus


On Jun 18, 2014, at 12:03 AM, Mark Stobbe <[email protected]> wrote:

> Hi,
> 
> I have a decimal column which is translated to a BigDecimal. When the value
> is equal to 0 and I set the value equal to 0 again, it will actually
> perform a SQL UPDATE. The two objects are "==", but they are "equals".
> In the source I found in de PersistentObjectHolder.setValue the following:
> 
> Object oldValue = setValueDirectly(value);
> if (oldValue != value && relationshipOwner.getObjectContext() != null) {
>  relationshipOwner.getObjectContext().propertyChanged(relationshipOwner,
> relationshipName, oldValue, value);
>  ..
> }
> 
> Is this piece of code used for non-primitive properties?
> 
> Mark
> 
> PS: I am using 3.2M1

Reply via email to