• 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: Little help with a qualifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Little help with a qualifier


  • Subject: Re: Little help with a qualifier
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 13 Jul 2009 20:52:55 -0700


On Jul 13, 2009, at 6:50 AM, Gustavo Pizano wrote:

Hello I have been thinking a while on the following qualifier..

I have the following db schema.

Thinking in terms of DB schema is going to be an obstacle to effectively grasping EOF and using it to your fullest potential. I only think about this level if I am optimizing. Think about the model, the relationships, and Java objects.



I need to fetch all WG that has in TRANSLATIONSET a specific userID.

Think: I need to find all the WG where wg.translationSets().users() contains a specific user. Or I need to find all the WG where wg.translationSets() contains the TranslationSet where translationSet.users() contains a specific user. Or, breaking it down more, I need to find all the TranslationSets where translationSet.users() contains a specific user, then I need to find all the WG where wg.translationSets() contains one of those TranslationSets



but so far what I have from the user is the name... so I will need to get the userID something like toUser.NAME.eq(name).

any ideas?

Break it down (I will use the syntax that I have been using as I have not started using ERXKey, yeah, yeah, I know):


1. Find the User
ERXQ.equals(User.NAME, name)


2. Find the TranslationSet ERXQ.contains(TranslationSet.USERS, user) * this contains might not work for all databases

3. Find the WG
OK. This gets a bit trickers. Time to break out the Wonder qualifiers in er.extensions.eof.qualifiers. If those let you down, there are more in the Houdah framework. Sometimes you have to play with these to find one that works / generates the SQL you want.


ERXExistsQualifier looks promising

EOQualifier tsQual = new ERXExistsQualifier(ERXQ.equals(User.NAME, name),
TranslationSet.USERS);


EOQualifier qual = new ERXExistsQualifier(tsQual, WG.TRANSLATIONSETS);


ERXQualifierInSubquery might work too
EOQualifier qual = new ERXExistsQualifier(tsQual, TRANSLATIONSETS.ENTITY_NAME, WG.TRANSLATIONSETS);



No guarantee that either of those will work, but that is the direction to look in.



Chuck



Attachment: DBSchemainPDF.pdf
Description: Adobe PDF document


-- Chuck Hill Senior Consultant / VP Development

Learn WO at WOWODC'09 East in Montréal this August!
http://www.wocommunity.org/wowodc09/east

http://arstechnica.com/apple/news/2009/07/webobjects-sliced-from-106but-prognosis-of-death-premature.ars

 _______________________________________________
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: Little help with a qualifier
      • From: Gustavo Pizano <email@hidden>
References: 
 >Little help with a qualifier (From: Gustavo Pizano <email@hidden>)

  • Prev by Date: Re: WOSwitchComponent question
  • Next by Date: Re: WOSwitchComponent question
  • Previous by thread: Little help with a qualifier
  • Next by thread: Re: Little help with a qualifier
  • Index(es):
    • Date
    • Thread