Aha, I see. last night I was thinking in the 3rd option you mentioned. get the Translationset for a givne user, then load all the WG where wg.translationSets contains one of those.
On Tue, Jul 14, 2009 at 5:52 AM, Chuck Hill <[email protected]>wrote: > > 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) > > maybe this step is not necesary as is the user that its logged in the session as authenticatedUser, no? > > 2. Find the TranslationSet > ERXQ.contains(TranslationSet.USERS, user) > * this contains might not work for all databases > ok so this will give me the NSArrya of translationSet that contains user. got it. > > 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 > mmmmm this one is it a comment? > > EOQualifier tsQual = new ERXExistsQualifier(ERXQ.equals(User.NAME, name), > > TranslationSet.USERS); so here if I understood good, you create a qualifier to get the tranlsationsets for a given user as in step 2, but this time you get only the qualifier isnt it? > > > EOQualifier qual = new ERXExistsQualifier(tsQual, WG.TRANSLATIONSETS); > > and then you create a qualifier mixing all the above together. after I will need then to fetch the data with that qual. something like NSArray<WG> wgForUser = fetchRequieredWg (qual); ? > > 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. > I will check and see how will it work an let you know. thanks for the Help. G. > > > Chuck > > > > > > -- > 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 protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
