• 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: hyper relationship howto?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hyper relationship howto?


  • Subject: Re: hyper relationship howto?
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Mon, 21 May 2007 23:35:52 +0200

Hello YL,

Is this not a good example of where WO inheritance mapping could come in handy? To be honest, I have never used inheritance till now, never really needed it, but if I understand you correctly, the problem you describe makes me think it that direction.

So, you could have all the entities that need address related functionalities inherit from AssociationOwner, thereby instantly having the toMany relationship towards Address in them. Hm, I suppose it is not as easy as it sounds, and most likely single table inheritance is not feasible, but still.

It is my impression that it would be an easier and also much more EOF- friendly way.

As for an approach without inheritance, the way I see it, it would be a lost cause. You just end up fighting one of the basic ideas of relationships: that they know where they are pointing, statically. Let them know where they are pointing (AssociationOwner), and they will stay happy. The shortcoming would be that EOF would be the only one holding the information needed to understand all this. Where the basic idea of what you were describing would make it much easier for other systems to also use the same data structure.

Also, regarding the actual situation you have described (things relating to addresses), I am in the same situation (many entities relating to addresses), and my solution is simply not to model the relationship towards the address owner. Because I see addresses as not-reusable data, i.e., there is a very small chance that two address objects are identical and thereby need to be shared among multiple address owners. So, I don't really need to know who is the owner of a particular address. I need to know what is the address of the owner. Anyway, in my scenario this is just two or three entities (which are address owners), so it is not a big issue. If it were more, or I needed the path from an Address towards it's owner, I probably would try to solve it with inheritance, as described above.

Best regards,
Flor


There are some practical reasons that one would hope some relationships
among many entities can be treated as one:


businessUnit <<--->>  address <<--->> person
may be ideally treated as

associationOwner (unit, person, ....) <-->> AddressAssociation <<-- > Address

By a proper implementation of AddressAssociation, address related problems
can be treated in a uniform way across many entities. And the reverse
problems(from address to objects have something to do with it) can be solved
equally easy.


Let's say AddressAssociation has the following attributes:

oid, oidAddress, oidOwner, ownerEntityName, startTime, endTime, oidType,
status, notes


That way, the relationship's context can be recorded in a proper way (in
reality, relationships are certainly not contextless). Also, an obj can now
have many addresses as it actrually does, and the oidType can tell the kind
of relationship (owner? rent? ...).


There are many things can be better handled by hyper-relationships.

Such relationships are not typical in IT practice but very common in real
world. Without EOF or similar frameworks, doing things like this can be too
costy, that's why WO:-). But...


In EOF, the callenge of such thing is mainly about to making

newAdressAssociation.setOwner(newOwner)
or   newAdressAssociation.addObjectToBothSidesOfRelationshipWithKey
(newOwner,"owner")
work.

In theory, EOF's key assignment logic is good enough for such generalized
case, It just not designed to look at the EOModel and realize hyper
relationships, and take care of attribute pair (oidOwner,ownerEntityName).
I can be wrong since I'm not doing much on most new version of WO


Thanks for any ideas

_______________________________________________ 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: hyper relationship howto?
      • From: Chuck Hill <email@hidden>
References: 
 >lock an entity? (From: "YL" <email@hidden>)
 >Re: lock an entity? (From: Chuck Hill <email@hidden>)
 >Re: lock an entity? (From: "YL" <email@hidden>)
 >hyper relationship howto? (From: "YL" <email@hidden>)

  • Prev by Date: Re: Simple General Search Qualifier
  • Next by Date: WOPopUpButton issue
  • Previous by thread: hyper relationship howto?
  • Next by thread: Re: hyper relationship howto?
  • Index(es):
    • Date
    • Thread