• 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: Comparing EOs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing EOs


  • Subject: Re: Comparing EOs
  • From: Chuck Hill <email@hidden>
  • Date: Wed, 29 Mar 2006 10:39:02 -0800

Hi,

On Mar 29, 2006, at 6:34 AM, Jerry W. Walker wrote:

Hi, Miguel,

On Mar 29, 2006, at 9:04 AM, Miguel Arroz wrote:
Something I could still not figure out from the docs... what is the standard implementation of the "equals" method in EOs? How does WebObjects compare objects if I do not implement the equals method?

The documentation for EOCustomObject says the following:

=========================================
equals - public final boolean equals(Object other)

EOF requires all EOs define equality as (this == other) To compare EOs in different EOEditingContexts, consider instead comparing their EOGlobalIDs with equals()
=========================================


Although the grammar isn't the best, it's pretty clearly saying that if you don't override the equals method, it compares for object equality (that is, it tests whether both the message recipient reference and the argument object reference are references to the same object instance).

The sentence that starts, "To compare EOs in different EOEditingContexts, ...", is simply suggesting a more effective implementation to compare EOs across editing contexts if you care to override the method.

I don't think it is suggesting _replacing_ the equals() method for EOs. For that would violate: "EOF requires all EOs define equality as (this == other)". I am near certain that changing the implementation of equals() would directly result in disaster.


Chuck


The suggestion is a good one, since two EOs from different editing contexts will be different objects, even if they represent the same record from the database. By comparing EOGlobalIDs, you will effectively test whether they represent the same persisted object rather than testing whether they are the same instance of an object.


--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ 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
  • Follow-Ups:
    • Re: Comparing EOs
      • From: Arturo PĂ©rez <email@hidden>
    • Re: Comparing EOs
      • From: Ken Anderson <email@hidden>
References: 
 >Comparing EOs (From: Miguel Arroz <email@hidden>)
 >Re: Comparing EOs (From: "Jerry W. Walker" <email@hidden>)

  • Prev by Date: Re: URGENT issues with CLOSE_WAIT states
  • Next by Date: Re: Comparing EOs
  • Previous by thread: Re: Comparing EOs
  • Next by thread: Re: Comparing EOs
  • Index(es):
    • Date
    • Thread