Re: How to handle relationship properties?
Re: How to handle relationship properties?
- Subject: Re: How to handle relationship properties?
- From: Art Isbell <email@hidden>
- Date: Sun, 1 Jan 2006 13:08:35 -1000
On Jan 1, 2006, at 12:27 PM, Miguel Arroz wrote:
User user; // Assume this exists
File file; // Assume this exists
UserFile userFile =
giveMeTheRelationhipObjectBetweenTheseTwoObjects(user, file);
What I want to know is how to write the
giveMeTheRelationhipObjectBetweenTheseTwoObjects() method! ;)
As was explained previously, you need to modify the many-to-many
relationship that EOModeler will create for you so that you can
access the join entity (UserFile, in your case). To do this, you
need to delete the flattened relationships User.files and File.users
and make the underlying relationships User.userFiles, File.userFiles,
UserFile.user, and UserFile.file class properties. EOModeler makes
the compound primary key of the join entity class properties which is
unnecessary, so I always remove these primary keys from the list of
class properties. Then I ask EOModeler (or eogenerator) to generate
the Java class files so that accessor methods for the new class
properties will be created.
After doing this, the UserFiles related to a User, user:
NSArray userFiles = user.userFiles();
and the UserFiles related to a File, file:
NSArray userFiles = file.userFiles();
Aloha,
Art
_______________________________________________
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