Re: An EnterpriseObject Design Question...
Re: An EnterpriseObject Design Question...
- Subject: Re: An EnterpriseObject Design Question...
- From: Jean-François Veillette <email@hidden>
- Date: Sat, 31 Dec 2005 10:55:41 -0500
I had to do something similar (not the same though) last summer, here
is something to try ...
In EOmodeler, model your interface (X) as an abstract entity. In the
user info dictionary for that entity, add some key that will tell
EOGenerator ( your custom template) that it's an interface.
For A and B, add in the user info dictionary a key that will tell
EOGenerator (again, custom template) that it implement X (not a
subclass), add all required (by X) attributes and relations.
For G, define your relation with entity X.
I could send you my files off-list if you want to see what I did for my
similar problem.
In my case, X wasn't an interface, I was able to model it as a
superclass (java-side) and not tell EOModeler about it.
I didn't have complex relationship handling.
- jfv
Le 05-12-26, à 14:58, Kieran Kelleher a écrit :
Java interfaces allow us to implement flexible relationships between
objects or just plain flexibility using composition, but I am kinda
confused as to the best way to implement such
relationships/composition in my EOModel.
For example, let's say I have Entity A, B and C and each implements
the X interface. Now let's say I have entity G which by composition
has a to-one relationship with an object that implements the X
interface. How would I model that?
Would it require something custom like having two attributes in entity
G, namely 'typeXRelatedEntityName' and 'typeXRelatedEntityOid' and
then giving G custom attribute getter/setter [ x(), setX( X anObject)
] that retrieves the related entity by fetching the single entity
using the two attributes? Is there anyone using a pattern like this or
a better one for persistent relationships to various objects that
implement an interface? Any gotchas/pitfalls?
Regards and thanks, Kieran
PS. I don't want to use inheritance since A, B and C are quite
different and I want the flexibility to add other entities that
implement interface X in the future.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
http://www.freeiPods.com/?r=21419063
_______________________________________________
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