• 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: fetching from a number of entity subclasses simultaneously
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fetching from a number of entity subclasses simultaneously


  • Subject: Re: fetching from a number of entity subclasses simultaneously
  • From: Jonathan Rochkind <email@hidden>
  • Date: Mon, 16 Feb 2004 10:37:06 -0600

If you have those _entities_ organized in an inheritance hierarchy in the model (see "set parent entity" in EOModeler), then you should be able to fetch against the 'base' entity, and get results from all the sub-entities. EOEntity inheritance can be a bit confusing sometimes though, and occasionally doesn't work like it's supposed to. But the functionality you're talking about is theoretically supported by EOF, via entity inheritance, and in general I hear it works pretty well (although I don't use it too much).

Note that even with entity inheritance, a seperate trip to the db will need to be made for each entity. [Except perhaps in some cases of 'single table inheritance', where all entities live in the same table, EOF may be smart enough to do just one fetch; not sure]. If the entities are in seperate tables, of course, then seperate fetches are neccesary to query all the tables.

Oh wait... now that I look at your question more carefully, I'm not even sure I'm answering the question you mean to ask, I'm confused. You talk about 'base classes' and 'subclasses', implying an inheritance hierarchy, but then you say you want to get results of the base class only, but 'based on' attributes from the sub-classes. So apparently this isn't an inheritance hiearchy, it's a composition/relationship type thing? I'm confused about what you want to do. If you actually have a relationship defined from this "base" entity to the "sub" entities, then of course you can create a qualifier and fetch spec that goes accross a relationship.

I'm confused about exactly what you want to do. If what you need is an outer join or sub-query, you might be interested in ERXQualifierInSubquery, which provides a way to create subquerries in qualifiers. An SQL subquery can usually do whatever an outer join can do.

Hope this info helps; if you explain better what you want to do (maybe summarize what your model looks like or something), maybe someone can provide more detailed help.

--Jonathan

At 12:42 PM -0500 2/14/04, Adam Ramadan wrote:
Hi,

I'm trying to implement a search feature for my application, and I'm
wondering what the best way to implement it using EOF is. I have a base
entity with a number of subclasses, and I wish to search in the attributes
of the various subclasses with the result a NSArray of the base class. I
looked into fetch specifications but it seems that they can only work in the
context of a single entity. I guess I'm wondering it there is some way to
write the SQL (probably doing a number of outer joins) and organize the
result of the query in a way the EOF can understand and work with. Is this
possible or am I stuck with using JDBC for this?

Any suggestions would be greatly appreciated,
Adam Ramadan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >fetching from a number of entity subclasses simultaneously (From: "Adam Ramadan" <email@hidden>)

  • Prev by Date: locking editing context when removing item
  • Next by Date: Re: Accessing elements of an Array using a flat Key
  • Previous by thread: fetching from a number of entity subclasses simultaneously
  • Next by thread: searches
  • Index(es):
    • Date
    • Thread