Re: EOModel needs an easy tweak
Re: EOModel needs an easy tweak
- Subject: Re: EOModel needs an easy tweak
- From: Mark Wardle <email@hidden>
- Date: Sat, 6 Nov 2010 19:35:14 +0000
Hi Farrukh,
I'm no expert on these matters but unless I have a very simple and
straightforward plan of inheritance that would be immediately obvious
to someone else joining the project, I've avoiding using EOF
inheritance. I've dabbled with a number of options depending on the
exact circumstances and most importantly, what has the *correct
real-life semantic*.
For instance, I've used enums to represent behaviours and have linked
these to behaviour classes - the enterprise objects can simply call
its registered behaviour object.method - I'm basing this on posts to
the list from Ramsey.
In other situations, I've simply used java interfaces and implement
these within separate entities perhaps factoring out common
functionality into a helper class.
For your case, I'm finding it difficult to imagine why two entities
(IS-A) have such different relationship requirements. If you really
need to do this and want to use EOF inheritance, then perhaps you can
have two trees of inheritance. The first tree would have Entity X as
root. These entities would defer handling of relationships to one of
two entities that provide the appropriate relationship behaviour -
to-one or to-many.
Good luck,
Mark
On 6 November 2010 11:39, Farrukh Ijaz
<email@hidden> wrote:
> Hi EOF-ologists,
>
> I've a modelling issue and need to know what could be the suitable fix (or tweak) to fulfil the requirement.
>
> Below is the existing EO Model.
>
>
> I've two entities (Entity A and Entity B) extending Abstract Entity X but these entities have their own tables (no single table inheritance). I need to design Entity D and Entity E where Entity D has a toMany relationship with Entity E and Entity E needs to have a toOne relationship with Entity A, Entity B, Entity C and Entity D.
>
> 1. One way can be for Entity E to have four different relationships such as toEntityA, toEntityB, toEntityC and toEntityD. (This is _not_ desirable)
> 2. The other way mentioned in the lower diagram where Entity A, Entity B, Entity C and Entity D extend Abstract Entity X and Entity E will have toOne relationship with Abstract Entity X. (This is _desirable_).
>
>
> What would be the easiest way to model such relationship? I'm _not_ relationship expert so may be the way I assumed the model (second diagram) can be wrong or practically impossible?
> Also note that I cannot make Entity C and Entity D to extend Abstract Entity X due to some design constraints therefore I think to introduce Abstract Entity Alpha.
>
> Thanks,
>
> Farrukh
>
>
>
>
> _______________________________________________
> 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
>
--
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK
_______________________________________________
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