• 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: qualified to-many relationships?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: qualified to-many relationships?


  • Subject: Re: qualified to-many relationships?
  • From: Chuck Hill <email@hidden>
  • Date: Sat, 09 Jul 2016 04:37:04 +0000
  • Thread-topic: qualified to-many relationships?

The answer depends on your definition of “decent”.   There is nothing in EOF, and nothing that I am aware of in Wonder that will do this.  To achieve this you need to:

 

1.       Write the access method like yo have below, but cache the result for performance.

2.       Write the mutator methods (if you need them) to work on the original EOF relationship

3.       Modify the mutator methods of the original relationship to either invalidate or update this cache (update is faster but harder to write)

4.       Intercept certain EOF operations/notifications so that the cache can be updated or invalidated when EOF changes the underlying snapshots

I can dig the details for (4) out for you if you want to pursue this.

 

Chuck

 

From: <webobjects-dev-bounces+chill=email@hidden> on behalf of OC <email@hidden>
Date: Friday, July 8, 2016 at 1:11 AM
To: WebObjects-Dev Mailing List <email@hidden>
Subject: qualified to-many relationships?

 

Hi there,

 

is there a way to define and use a to-many relationship, derived from a modelled one, by limiting the results by a qualifier?

 

I have got an entity, say, "DBTable", whose to-many relationship "records" returns a set of eos of entity "DBRecord". That works all right.

 

Now, I need to implement a "qualifiedRecords" relationship, which would work this way:

 

===

class DBTable ... {

  NSArray qualifiedRecords {

    EOQualifier qq=ERXSession.session().recordQualifier; // the qualifier depends on current user and other conditions of the current session

    return EOQualifier.filteredArrayWithQualifier(this.records(),qq);

  }

}

===

 

With small objects, I would use precisely the code above. Alas, my DBTables contain _lots_ of DBRecords, and thus the above implementation would get terribly slow by fetching all of them and then re-filtering them each time the relationship is accessed.

 

What I need here is same behaviour functionality-wise, but at a lower level, sort of like EODatabaseDataSource's auxiliaryQualifier, but somehow bound to the particular relationship, so that

 

(a) it is not needed to fetch all records -- the "qualifiedRecords" relationship would, when fired, automatically fetch only the qualified ones

(b) records are fetched once and then cached, just like it is with normal relationships

(c) I can use things like

 

ERXEOControlUtilities.objectCountForToManyRelationship(sometable,"qualifiedRecords")

 

etc. seamlessly, and they work as expected.

 

Is there a way to do this at all? Perhaps I am just blind, but I cannot find any decent solution :/

 

Thanks and all the best,

OC

 

 

_______________________________________________

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

 _______________________________________________
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: qualified to-many relationships?
      • From: OC <email@hidden>
References: 
 >qualified to-many relationships? (From: OC <email@hidden>)

  • Prev by Date: Re: Splitting big database tables to speed up?
  • Next by Date: Re: Splitting big database tables to speed up?
  • Previous by thread: Re: Horizontal inheritance to splitting big database tables to speed up?
  • Next by thread: Re: qualified to-many relationships?
  • Index(es):
    • Date
    • Thread