Re: A relationship to a static Entity that is not saved to the db (or part of the EOModel)
Re: A relationship to a static Entity that is not saved to the db (or part of the EOModel)
- Subject: Re: A relationship to a static Entity that is not saved to the db (or part of the EOModel)
- From: Jean-François Veillette <email@hidden>
- Date: Tue, 6 Jul 2004 09:38:55 -0400
I had this secanio,
what I ended up doing was to presend the foreign key in A (to S) as
visible. Those where identified as stateCode.
Then I my code I added wrapper method, state() and setState() where
they would deal with my State object and would internally set the state
code as needed.
In fact, when I had to do it, it was part of a more generalized use of
such static references objects, so I did create a DBStatic object, that
would read from a .plist (was actually a .xml) the static database
definition. The wrapper used the static method of DBStatic to access
the db, as they wanted, they could do a lookup based on the key, they
could list all the element for a given ~table (used in popup menu,
selection list for example).
if you need, I could probably send you some code, let me know,
- jfv
Le 04-07-05, ` 19:54, Stefan Foulis a icrit :
I have the following scenario:
There is an EO Entity built in EOModeler, lets call the Class "A" and
its instances "Ax". Every Ax can be in one of 5 different states.
These states ("S", "Sx") have some additional member variables, like a
String holding the name of the state. These member variables never
change and are known at development time.
So instead of saving these states ("Sx") as usual EnterpriseObjects in
the database and defining them as read-only I'd like to create them in
the sourcecode, never creating a table for them in the database. One
of their member variables would be an Integer, the primary key.
Every "Ax" has an Integer aswell, the foreign key. It is saved in the
database along with other data.
Now there should be a method in "A" called state(); that returns the
corresponding state object instance "Sx" and setState(State newState);
that sets its foreign key according to the state object given as
parameter.
"S" should have a method that returns all "Ax"'s that are in that
state.
Has anyone got an idea how this can be accomplished (without making
the foreign key in "A" directly visible) ?
I hope I was able to describe this scenatio in an understandable
fashion... but feel free to ask any questions if the problem isn't
clear.
Thanks for any help.
stefan
_______________________________________________
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.
_______________________________________________
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.