• 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: In memory qualification issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: In memory qualification issues


  • Subject: Re: In memory qualification issues
  • From: Robert Walker <email@hidden>
  • Date: Wed, 21 Dec 2005 17:25:43 -0500

public boolean equals(Object x)
Compares this BigDecimal with the specified Object for equality. Unlike compareTo, this method considers two BigDecimals equal only if they are equal in value and scale (thus 2.0 is not equal to 2.00 when compared by this method).
1. BigDecimal equality is not handled properly. Even if the objects are initialized from strings or database fields with proper resolution (ie not from floats!), EOKeyValueQualifier is not able to determine proper equality. The way I made this work was to subclass EOKeyValueQualifier, override evaluateWithObject(), check if the objects are BigDecimals, and do a compareTo() instead of equals().

From the Java API:

Overrides:
equals in class Object

Parameters:
x - Object to which this BigDecimal is to be compared.

Returns:
true if and only if the specified Object is a BigDecimal whose value and scale are equal to this BigDecimal's.


See Also:
compareTo(java.math.BigDecimal)

Use compareTo() for checking equality on BigDecimal not equals....

2. In Objective-C, I never had a problem with object equality for relationships. If the 2 objects have the same Global ID, but are from 2 different contexts, EOKeyValueQualifier now no longer sees them as equal as it should. The way I've fixed this is to check for EOs in the comparison, and compare their global IDs instead.

I've seen this issues as well. Your solution is probably best.

On Dec 21, 2005, at 5:09 PM, Ken Anderson wrote:

List Colleagues,

I've had a couple of experiences lately with in-memory qualification and EOKeyValueQualifier that I need to bounce off the list to make sure I'm not losing it. I've had 2 recent issues:

1. BigDecimal equality is not handled properly. Even if the objects are initialized from strings or database fields with proper resolution (ie not from floats!), EOKeyValueQualifier is not able to determine proper equality. The way I made this work was to subclass EOKeyValueQualifier, override evaluateWithObject(), check if the objects are BigDecimals, and do a compareTo() instead of equals().

2. In Objective-C, I never had a problem with object equality for relationships. If the 2 objects have the same Global ID, but are from 2 different contexts, EOKeyValueQualifier now no longer sees them as equal as it should. The way I've fixed this is to check for EOs in the comparison, and compare their global IDs instead.

It seems from the documentation that you can override comparison support, but I can't seem to find out how. Any pointers? Anyone have similar experiences?

Thanks,
Ken

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


This email sent to email@hidden

_______________________________________________ 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: 
 >In memory qualification issues (From: Ken Anderson <email@hidden>)

  • Prev by Date: Re: signed int
  • Next by Date: [OT]Re-All requests go to only the parent domain (MacOSX Server 10.4)
  • Previous by thread: In memory qualification issues
  • Next by thread: [OT]Re-All requests go to only the parent domain (MacOSX Server 10.4)
  • Index(es):
    • Date
    • Thread