I am having some problems with a component mapping. I have a class which maps a certain property as a component. Call it Parent. Call the component class Component.
When I save the Parent with a Component consisting only of null property values and then reload the Parent the component property is now null. So far so good. This is exactly as per the documentation.
If I now set the component property of the reloaded parent to a new empty Component instance and flush the session, the parent gets saved, even though the new component is supposed to be equivalent to null.
This appears to be because ComponentType.isDirty returns true if either the old value or the new value (but not both) is null.
Code:
if ( x == y ) {
return false;
}
if ( x == null || y == null ) {
return true;
}
Is there someway that I can avoid this spurious update?
For reference, this happens in version 3.2.5.ga. I have produced a minimal test case with the classes Parent and Component which I can attach if clarification is needed.