• 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: Mapping multiple EOs to one table
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mapping multiple EOs to one table


  • Subject: Re: Mapping multiple EOs to one table
  • From: Ricardo Strausz <email@hidden>
  • Date: Mon, 25 Aug 2003 15:48:44 -0500

Sorry for the late replay...
Rethinking the original problem (and trying to understand better STM), I make out the following example:


In a "parent" table (lets call theTable) I have defined the following columns:
PK, type, anInt, aFloat


and, say, with the following rows:
1, 3, 1, 1.0
2, 1, 1, null
3, 2, null, 1.0

and, I want three entities (say e1,e2 & e3) maped to theTable (one for each type); that is:
type=1 <=> all but 'aFloat'
type=2 <=> all but 'anInt'
type=3 <=> full row


This is supposed not to have problems, ok?
Now, observe that type 3 = type 1 + type 2...

Does the "type" have to be persistent stored?  (I am not sure)

If not, this may do the trick... do you see what I mean?

If I ask for allObjects in e1 it will show those with PKs 2 and 1
if I ask for allObjects in e2 it will show those with PKs 3 and 1
and if I ask for allObjects in e3 it will show all: PK 1, 2 and 3

Until here, I do not see problems (unless there is something I am "blinding"); I can see a problem if, in one hand I invoke e1 (which brings me PK 1) and in other e2 (which brings me ALSO PK 1) ---and say, in that order---... If I undestud what you wrote, the second version of such an object will be kind of e1, insteed of e2, so I will not be able to access 'anInt', all this due to the fact that EOF will use a GlobalID; is that correct?

If so, I can refault the object and fetch it from e3...
Does this solves the problem?

Dino


On miircoles, agos 20, 2003, at 15:19 America/Mexico_City, Chuck Hill wrote:


Oh, OK.  I should have guessed that...

Maybe I am getting confused too. This all started, if I recall correctly,
when Ray wanted to use more than one entity mapped to a single row to
achieve different views of the same data. That is not what EOF inheritance
is for.


For single table inheritance, each row should map to a unique entity which
maps to a unique Java class. In order for this to work each row needs to
have some column that uniquely identifies which entity it corresponds to.
Do all this and it works fine, EOF inheritance == Java inheritance.
Sub-classes can have their own behaviour and properties in addition to the
behaviour and properties inheritance from the parent(s).


If you don't have this unique mapping then EOF will get confused and create
the wrong Java class for a row (or at least wrong in the sense of what a
fetch requested). Then EOF inheritance == Java confusion.



Chuck
_______________________________________________
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: 
 >Re: Mapping multiple EOs to one table (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Can Webobjects Do This..
  • Next by Date: Re: 4.5 question - _holdMe array trick
  • Previous by thread: Re: Mapping multiple EOs to one table
  • Next by thread: Re: Mapping multiple EOs to one table
  • Index(es):
    • Date
    • Thread