• 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: How to handle relationship properties?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to handle relationship properties?


  • Subject: Re: How to handle relationship properties?
  • From: Miguel Arroz <email@hidden>
  • Date: Tue, 3 Jan 2006 23:15:47 +0000

Hi!

On 2006/01/03, at 22:59, Chuck Hill wrote:

Allow me to suggest some cleaner ways of doing this:

EOQualifier userQualifier = EOQualifier.qualifierWithQualifierFormat ("user = %@", new NSArray(user));
EOQualifier accountQualifier = EOQualifier.qualifierWithQualifierFormat("account = %@", new NSArray (account));
EOAndQualifier finalQualifier = new EOAndQualifier(new NSArray( new Object[] {userQualifier, accountQualifier}));
EOFetchSpecification fetchSpecification = new EOFetchSpecification (AccountUser.class.getName(), finalQualifier, null);
NSArray objects = context.objectsWithFetchSpecification (fetchSpecification);


if( objects.count() != 1 ) {
NSLog.out.appendln("accountUserForUserAndAccount - could not obtain a single accountUser object!");
}


return (AccountUser)objects.objectAtIndex(0);

...

NSArray args = new NSArray(new Object[] {user, account});
return (AccountUser)EOUtilities.objectWithQualifierFormat(context, "AccountUser", "user = %@ and account = %@", args)



Ah, two lines. That feels better!

And they actually work! :D Thanks! It was the stupid "usedID" instead of "user" problem... NEVER code before noon...


About the "AccountUser", I try to avoid string to avoid typing errors and such. The class name should be the entity name... right?

  Nice code reduction, btw... :)

  Yours

Miguel Arroz

"We have no sympathy for the lost souls
We've chosen the path of disgrace
We give this life to our children
And teach them to hate this place" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com


_______________________________________________ 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: How to handle relationship properties?
      • From: Chuck Hill <email@hidden>
References: 
 >How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Arturo Pérez <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Arturo Pérez <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Arturo Perez <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Arturo Perez <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Arturo Perez <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Chuck Hill <email@hidden>)
 >Re: How to handle relationship properties? (From: Miguel Arroz <email@hidden>)
 >Re: How to handle relationship properties? (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: How to handle relationship properties?
  • Next by Date: Re: How to handle relationship properties?
  • Previous by thread: Re: How to handle relationship properties?
  • Next by thread: Re: How to handle relationship properties?
  • Index(es):
    • Date
    • Thread