• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOToOneRelationship and "dirty" editing context
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOToOneRelationship and "dirty" editing context


  • Subject: Re: WOToOneRelationship and "dirty" editing context
  • From: Lachlan Deck <email@hidden>
  • Date: Fri, 6 Jan 2006 09:55:32 +1100

Hi there,

On 06/01/2006, at 8:00 AM, email@hidden wrote:

Thanks for your input.

On 05 Jan, 2006, at 02:12 PM, Lachlan Deck wrote:

On 06/01/2006, at 4:16 AM, email@hidden wrote:

Try updating your User like...

public void setDepartment( Department aDepartment ) {
	Department currentDepartment;

	currentDepartment = department();
	if ( currentDepartment != aDepartment ) {
		...
	}
}

That way your entity will not "update" itself when you're simply giving it the same value.

While this may work to avoid updating the entity itself, it will

1) break our existing auditing scheme that relies on monitoring the editing context's updatedObjects NSArray.

It shouldn't. It'll mean that the object won't get placed into the updatedObjects NSArray when it's not actually being updated - but given the same value.


2) require us to manually update nearly all of our entities in our application (well over 200 that will have to one relationships) with customized code. This seems like a lot of work in order to use an interface component (WOToOneRelationship).

Hmm. An easier option may be to create a super class (i.e., EOGenericRecord subclass) that simply overrides:


public void takeStoredValueForKey( Object value, Key key ) {
	Object currentValue;

	currentValue = this.valueForKey( key );
	if ( value != currentValue &&
	     ( value == null ?
	       currentValue != null :
	       ! value.equals( currentValue ) ) ) {
	    super.takeStoredValueForKey( value, key );
	}
}

Then you've only got to change the inheritance scheme (i.e., MyEntity extends KTBGenericRecord )

I guess I am curious why any object gets tagged as "updated" in the editing context before user manipulation when using this component?

Is it an EOF issue or they way the WOToOneRelationship works? I have tried the ERXToOneRelationship and it too has the same effect of tagging my object as modified upon initial display.

Is the form getting submitted somehow?

In the old post I referenced (http://www.wodeveloper.com/omniLists/ webobjects-dev/2000/November/msg00119.html), the author mentioned that WOToOneRelationship uses the takeValueForKey instead of the validateTakeValueForKey, and somehow this registers a change in the editing context even values are unchanged. I could not find either of these in the source for WOToOneRelationship, so I am not sure if this was fixed in later versions of WO.

I am still very new to WO, so sorry if this is so basic.

Hope the above is helpful..

with regards,
--

Lachlan Deck


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >WOToOneRelationship and "dirty" editing context (From: email@hidden)
 >Re: WOToOneRelationship and "dirty" editing context (From: Lachlan Deck <email@hidden>)
 >Re: WOToOneRelationship and "dirty" editing context (From: email@hidden)

  • Prev by Date: Re: WOToOneRelationship and "dirty" editing context
  • Next by Date: fun eomodeler error
  • Previous by thread: Re: WOToOneRelationship and "dirty" editing context
  • Next by thread: Re: WOToOneRelationship and "dirty" editing context
  • Index(es):
    • Date
    • Thread