Re: How to fetch eo with a specific relationship
Re: How to fetch eo with a specific relationship
- Subject: Re: How to fetch eo with a specific relationship
- From: "Daniele Corti" <email@hidden>
- Date: Wed, 6 Feb 2008 16:26:27 +0100
2008/2/6, Louis Demers <email@hidden>:
Hi,
I have 2 EO, Part and Category. Part has a to-one relationship to
Category. Category does not have a reverse to-many relationship.
Through a search/listing page of categories, the user can select a
Category and I wish to present all of the parts from this category. I
was hoping to not used the fields of the categories (like name,
type...) to do the search, and really use the EO itself as the
selection criteria. That lead meto consider using the primary key, but
every book /messages I looked through discourages one to use primary
keys/global ids. My guesses are:
1) that is a specific case where exposing/using primary keys is OK ?
Well, you CAN use PK, even it is not a good idea to manipulate it directly.
ERXGenericRecord, from Project Wonder, has the method primaryKey() that return a string with the value of the PK, you do not need to set the field as "manipulated" (I don't know how to say it) in the EOModel.
2) setup the reverse to-many relationship ?
IMHO, this is the best way to do it:
always set a inverse toMany relation for every ToOne, well, if you know that you'll never use it, you can avoid to set an inverse relationship, but in this case, you should find it usefull.
3) set querybindings (I use Display groups a lot) using the key name
of the relationship and the EO as the object and let WO figured it
out ? I seem to recall some message about this but could not find it
or sample code for that.
Sorry, I've not understand what you do... can you give an example?
4) use the fields of the category to form a complete specification.
That seems unsuitable in case two categories are named the same
(temporarily due to a mixup).
You should consider to set an Unique field in your EO, like categoryCode, it can also be Alphanumeric.
What is the real WOway of doing this.
I don't think there's an official WAY to do things, there are tested ways, but I usually like to experience new chances by myself.
Remember that WO allow you to do everything, so simply think of a way and try. If it doesn't work, you can retry ;-P
Thanks in advance.
Louis Demers eng.
www.obzerv.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
This email sent to email@hidden
--
Daniele Corti
AIM: S0CR4TE5
Messenger:
email@hidden
--
Computers are like air conditioners -- they stop working properly if you open
WINDOWS
--
What about the four lusers of the apocalypse? I nominate:
"advertising", "can't log in", "power switch" and "what backup?"
--Alistair Young
_______________________________________________
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