• 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: entity inheritance possibilities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: entity inheritance possibilities


  • Subject: Re: entity inheritance possibilities
  • From: Jonathan Rochkind <email@hidden>
  • Date: Mon, 08 Sep 2003 14:47:45 -0500

At 12:00 PM 9/8/2003 -0700, Ben Trumbull wrote:

A) The psuedo to-one 'relationship' can't be established until the destination is committed to the db.

Sure it can. Listen of the GIDChanged notification. Think like a union in C, either a pk-entity or a temporary GID. You'll want a direct reference to the object in the same EC.


You will not get the GIDChanged notification until after the save.

Ah, but this will get tricky. I have objectA which has a 'psuedo' relationship to objectB. This means that A needs to store fk and entityName. If B is not yet committed, and I make the relationship... then by the time I get the notification, A is _already_ saved to the db. With inconsistent state, since it has an entityName filled out, but not yet an fk. Or else the db or the model threw an exception because you _can't_ save A with just entityName and not fk. Or else the entityName wasn't set yet either, but still, by the time I've received the notification, it's too late for A to be saved in the same commit as B, which is ordinarily what you want.


I'm sure I could make it work reasonably, but it's going to be really tricky, I think, to get everything committed at the right time. [With a real relationship, EOF somehow magically takes care of it for you].

2) Only one of them will actually be valid; which one is valid is determined by the 'entityName' attribute, and we can use business logic to address the proper one.

It may mostly work. It will defeat prefetched keypaths and generally make life more complicated. The EOModel will not represent the actual object mapping, which may be confusing later. If this pattern is widely used, it will impact memory consumption.

Hmm. For vertical or horizontal inheritance, I seem to remember that EOF creates 'hidden' relationships behind the scenes to all the leaf entities anyway. So will manually creating all these relationships (to what could conceptually be an inheritance hiearchy, but isn't) impact memory any worse? Losing prefetched keypaths, no problem----if I had a horizontal or veritical inheritance hiearchy, multiple fetches would be needed to 'prefetch' anyway (and I suspect prefetching doesn't currently works with horizontal, and possibly vertical, inheritance anyway). I can manually fetch things efficiently when needed.


But the possibility that it will end up making things more complicated in ways we aren't even thinking of right now, that's cautionary. And on top of that, it still doesn't solve the problem of 'efficient relationship in the other direction'. (Hmm, I wonder if I want to go manually storing and retrieving snapshots that don't correspond to an actual relationship. Probably not, that's just asking for trouble. Unless I write an entirely new object to do it instead of using EODatabase. That's asking for trouble too).

Take your medicine now, don't create a maintenance nightmare later. Hack the PKs or export to XML, or whatever. Begin next week with something "normal".

I will have to see if I can come up with a workable plan to do this that: won't take me months; can be done with the hardware/software I have; won't require my apps to be down more than a very brief time for maintainance. I'm not looking forward to it. I don't know if I can do it.



Or don't do it at all. Your app works now, so maybe this problem doesn't need to be solved. Maybe there are alternatives to changing the entity relationships.

Yeah, that's one thing. But, see, my app is right now suffering from a poorly thought out workaround to lack of inheritance that I put in a long time ago when I was scared of inheritance---should have just used inheritance to begin with. So I'm running into problems with my rather baroque alternative to inheritance already, and want to replace it with something more elegant. My current implementation also makes it very dificult to add some features I'd like to add. Basically, I'm already suffering from the effects of a bad hack. Which perhaps should give me some humility, and dissaude me from trying to come up with a 'better' hack, instead just converting all the pks to allow true EOF inheritance. Hmm. Well, we'll see.


Maybe I'll try implementing some of these hacks in a little sandbox, and see what happens. Thanks for the advice.

--Jonathan


--

-Ben
_______________________________________________
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: entity inheritance possibilities (From: Jonathan Rochkind <email@hidden>)
 >Re: entity inheritance possibilities (From: Ben Trumbull <email@hidden>)

  • Prev by Date: Re: WO/HTML trick to check if page loaded completely?
  • Next by Date: Nullify rule not being invoked?
  • Previous by thread: Re: entity inheritance possibilities
  • Next by thread: WO/HTML trick to check if page loaded completely?
  • Index(es):
    • Date
    • Thread