Re: Array, dictionary and set in EOF
Re: Array, dictionary and set in EOF
- Subject: Re: Array, dictionary and set in EOF
- From: DevReseune <email@hidden>
- Date: Tue, 25 Nov 2003 09:16:26 +0100
Ok. Perhaps (surely) my englsih is worst than I think it is. Sorry.
So, for example, you have an entity Folder that contains many Documents.
Folder (1)----------(*) Document
But, you want to manage by hand the order of the list of documents.
With EOF, you can access to a NSArray of Documents in Folder.This array
is populated with the result of a SQL query, that returns an unordered
list of Documents. If you want to have a ordered list, you have to
fetch by hand or to sort the SQL raw results. So, you have to create
extra code to access the ordered list.
But now, you want to add a Document to the index 2, or invert Document
3 with Document 7. In a NSMutableArray, you can insertObjectAtIndex()
and replaceObjectAtIndex(). Each Document in your model has the index
additionally to the Folder primary key reference. The list is ordered.
With EOF, we access not to an array, but to a NSSet: unordered list of
objects that can be found only ones in the list. However, EOF uses a
NSMutableArray.
If you want more examples, you can read the Hibernate documentation
about collections:
http://www.hibernate.org/hib_docs/reference/html/collections.html
You'll see that Hibernate manages differently array (many-to-many), set
(one-to-many), list (one-to-many) and map (yes, a NSDictionary). You'll
see that Hibernate manages for you all the extra code and so, you have
real persistent collections. A real array, a real set and a real map.
No code. No fetch by hand. No sort by hand. The index is managed for
you. NO CODE.
Today, Hibernate is more powerfull than the EOF framework (but
EOEditingContext and notification are very usefull).
Frederic
Le 25 nov. 03, ` 00:03, Ray Ackland a icrit :
Frederic,
I would like to be able to answer your question, but I'm afraid I
don't really understand it. I do remember reading your post the other
week (but not its points), but I always believed that we are getting
an array - you can even choose how to order them in the fetch.
Can you point out to me (again) why it is really a set rather than an
array?
ray.
On Tuesday, Nov 25, 2003, at 11:09 Pacific/Auckland, DevReseune wrote:
I posted this question few weeks ago, but it's always topical. How
can we have real NSArray with EOF? Not a NSSet of objects (to-many
relationship), but a real ordered list of objects? Ditto for
NSDictionary.
_______________________________________________
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.