Not sure I have understood all the subtleties of being managed
objects, but as a personal preference, I would avoid the server all
together - but that's just me.  If you really have to use the server
then I would make the sorting a property of the persistence tier (i.e.
the database select queries) rather than mushed in with any business
logic.

If you really need them to be held in a sorted order in memory, don't
want to use the server and you have nested collections, implying a
parent-child hierarchy, then your best bet is probably to make the
sort order a property of the child collections.

I have this exact problem myself (6-level deep parent-child hierarchy)
and rather than insist that they are stored or carried around in a
sorted order I just made sure that they were sorted wherever the user
needed to see them sorted.  This shifts the problem from one of
persistence and/or data architecture to one of display and the
solution for me was more obvious.  However I have resisted the
temptation to show the data in a tree - there's always a better way. 
In my world the users don't care about the domain model so I don't
show it to them.

For procedural (aggregation style) operations I make sure I don't rely
on the order in which the data is held.  I have found maps on the
client via the mysterious Object object are very useful in these
circumstances.

Best of luck. Simon

--- In [email protected], Kevin <[EMAIL PROTECTED]> wrote:
>
> I am wondering what the best practice is for sorting nesting  
> collections in data managed or remote objects?
> 
> Sort on the server?  It is not hard for us to create SortedSet's (via  
> Java) on the server objects and then send those back.  The only  
> problem we have run into with this is that it seems that the sort  
> order is not updated when new objects are persisted via Flex.  For  
> example, the initial fill comes in sorted, however when we then use  
> addItem to a data managed, nested collection, the object is persisted  
> in the database, but the full set is not returned to flex and thus  
> the new sort order is not updated.  It seems that because of this  
> there is no reason to do any sorting on the server except for objects  
> that are not data managed.  Does this make sense?
> 
> Sort on the client?  It is easy enough to add sorts to  
> ListCollections. however when the ListCollections are nested inside  
> other objects where is the best place to add these sorts?  In the  
> constructor of the value object?  In the view which binds it? In some  
> collection listener?  With the simplicity of data binding it seems  
> that there is no great place to add a default sort to a collection.   
> Am I missing something obvious?
> 
> Sort in the destination config?  Is there a way to add a default sort  
> to a data-management-config destination?  It seems like this might be  
> an appropriate place to add a default sort declaration...
> 
> I would love to hear how others have addressed this situation?
> 
> Happy Holidays, Kevin
>


Reply via email to