Re: NSArray is not a NSSet. So why Apple confuse them in EOF?
Re: NSArray is not a NSSet. So why Apple confuse them in EOF?
- Subject: Re: NSArray is not a NSSet. So why Apple confuse them in EOF?
- From: David Neumann <email@hidden>
- Date: Sun, 9 Nov 2003 15:55:38 -0600
I believe it may have had something to do with performance (arrays vs
sets). Also one of the first things you want to do with a to-many array
is iterate through it and list it rather than perform set math, things
for which the NSSet adds no value over an NSArray. Also sometimes
people want to customize fault resolution and/or preserve the order
that a to-many was fetched in. Finally NSSets in particular don't want
their members to change over time, which means for EOs you'd have to
make copies.
You can iterate over a NSDictionary in code or in the template if you
like.
dave
On Nov 9, 2003, at 10:38 AM, DevReseune wrote:
Hi,
The to-many relationship returns a NSArray. But, a NSArray is an
ordered array, and an object can be more than one in it. In EOF, it's
false. For example:
Book 0..* (books) -------------- 1 (author) Writer
You can add only once, and the order is not preserved. So, it's a
NSSet.
In Hibernate, you can have a true array:
http://www.hibernate.org/hib_docs/reference/html/collections.html
<array name="foos" table="BAR_FOOS" cascade="all">
<key column="BAR_ID"/>
<index column="I"/>
<many-to-many column="FOO_ID" class="com.illflow.Foo"/>
</array>
or
<set name="names" table="NAMES">
<key column="GROUPID"/>
<element column="NAME" type="string"/>
</set>
So, why EOF hasn't the same feature? And how have it now?
But Hibernate has another important feature! It can manage for you a
NSDictionary (Map):
<map name="holidays" table="holidays" schema="dbo" order-by="hol_name
asc">
<key column="id"/>
<index column="hol_name" type="string"/>
<element column="hol_date" type="date"/>
</map>
When we can have the same feature in EOF?
Fridiric
_______________________________________________
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.