You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Øyvind Harboe (JIRA)" <ji...@apache.org> on 2009/02/18 13:46:45 UTC

[jira] Commented: (CAY-512) Keep DataObjects in commited state for no-op writeProperties

    [ https://issues.apache.org/cayenne/browse/CAY-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13247#action_13247 ] 

Øyvind Harboe commented on CAY-512:
-----------------------------------

hasChanges() has problems in my case for Cayenne 3.x and I wrote the following code to work around false postivies for hasChanges().

I think my observation belongs as a comment to this JIRA (even if I don't understant the details of the report) rather than a fresh report.

	/** DataContext.hasChanges() doesn't work because it returns true for "phantom" changes */
	static public boolean checkIfChanges(DataContext dataContext)
	{
		if (dataContext.hasChanges())
		{
			return !dataContext.getObjectStore().getChanges().isNoop();
		}
		return false;
	}


> Keep DataObjects in commited state for no-op writeProperties
> ------------------------------------------------------------
>
>                 Key: CAY-512
>                 URL: https://issues.apache.org/cayenne/browse/CAY-512
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 1.2 branch
>         Environment: M9-B1
>            Reporter: Mike Kienenberger
>            Assignee: Andrus Adamchik
>             Fix For: Undefined future
>
>
> Regression: Cayenne M9+ sets DataObjects as "modified" during no-op writeProperties
> writeProperty("x", "y") puts dataObject into a modified state when "y" was already the value of "x" before the method call.
> Before M9, object would remain in committed state.
> Object in my ObjectStore:
> <ObjectId:Announcement, ANNOUNCEMENT_ID=200>={<ObjectId:Announcement,
> ANNOUNCEMENT_ID=200>; modified; [enabled=>Y; description=>SNAP;
> contentList=>(..); effectiveEndDate=>Mon Oct 31 00:00:00 EST 2005;
> effectiveStartDate=>Thu Sep 01 00:00:00 EDT 2005;
> qualifiedViewpointList=>(..)]}
> ObjectDiff of record -- appears to indicate that nothing has changed.
> Same as the other 4 restored objects.
> Comparision of snapshot values to object store values shows nothing different.
> value= ObjectDiff  (id=3310)
>        arcSnapshot= HashMap  (id=3311)
>        currentArcSnapshot= null
>        diffId= 1
>        flatIds= null
>        nodeId= ObjectId  (id=3309)
>        objectStore= ObjectStore  (id=3200)
>        otherDiffs= null
>        snapshot= HashMap  (id=3312)
> org.objectstyle.cayenne.access.ObjectDiff@133d68a
> {}
> null
> 1
> null
> <ObjectId:Announcement, ANNOUNCEMENT_ID=200>
> org.objectstyle.cayenne.access.ObjectStore@c0cf
> null
> {enabled=Y, description=SNAP, effectiveEndDate=Mon Oct 31 00:00:00 EST
> 2005, effectiveStartDate=Thu Sep 01 00:00:00 EDT 2005}
> A workaround has been to add code in my BaseDataObject class to check
> for the old value equaling the new value in writeProperty(), and if
> so, do nothing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.