First off, did you know about resources/config/data-management-config.xml? It is sort of like our "asdoc" for configuration.
The below scenario should work without associations in data-mangement-config if the data structure forms a "tree" but won't work if it is a more general graph. If you use hierarchical values, we basically just send around complete serialized versions of the top level object (e.g. the company) for any change to any sub-object so it can get expensive for deep or large graphs. With the managed associations approach we will send over updates for individual items in the graph. With lazy=false, the server to client stuff will be the same but with lazy="true" we send over just a slice of the graph at a time and fetch referenced items individually so it is more flexible too. Jeff ________________________________ From: Kevin [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 20, 2007 7:25 PM To: [email protected] Cc: Jeff Vroom Subject: Re: [flexcoders] Need Help with DataServices pushing data to nested collections Thank you. I think I understand, but just in case here is a scenario of what we are doing. We get our list of companies from a fill operation so now we have a data managed collection companies. var departments : ArrayCollection = companies.departments; //to add an items departments.addItem(deptartment); //this works fine and pushes fine var employees : ArrayCollection = department.getItemAt(0).employees; //we usually get to this using a selectedItem from a DataGrid employees.addItem(employee); // this add to db but doesn't push var schedules : ArrayCollection = employees.getItemAt(0).schedules; //we usually get to this using a selectedItem from a DataGrid schedules.addItem(schedule); // this add to db but doesn't push I am guess that what you are saying is the above example will not "push" UNLESS we set up destinations for each of our collections and then set up associations for these collections. We are using annotations with Hibernate, but I seems to remember that we still need to do this step when using annotations. Would you say that in general if you would like to take full advantage of data pushing it is a better idea to use a "manage association" approach rather than the default "hierarchical approach"? Is there an API for the data-management-config file? I know we have had questions about what tags go where and the dev guide didn't seem to specify everything. Thanks for your help. We LOVE data services... when understand it and get it working!!! - Kevin On Nov 20, 2007, at 9:34 PM, Jeff Vroom wrote: It sounds like you do not have association tags in data-management-config.xml for each of these relationships and so are using the "hierarchical values" approach for managing the hierarchical data. This approach can save hierarchical stuff to hibernate fine if your hibernate associations have the "save-update" flag - since hibernate cascades the save operation down the object graph.. it will save the employee even when the change is made to the company. This approach also can push these changes to other clients but only when you modify them via the parent - i.e. in this case, you'd have to modify company.departments[i].employees and only another client that had retrieved the same company would see the new employee get pushed to it. If you are doing a query to get the employees directly, data management won't know it is the same employee and so those clients would not get that pushed change. For this more granular approach, you need to define the associations in your data-management-config.xml to match the associations in your hibernate configuration. That way DMS knows the ids of each entity, the data types and stuff like that and can keep everyone in sync. Jeff ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Sent: Tuesday, November 20, 2007 5:11 PM To: [email protected] Subject: [flexcoders] Need Help with DataServices pushing data to nested collections We are trying to use a hierarchical approach with DataServices but are having trouble with our nested VO collections. The data is getting properly saved to the database (via Hibernate) but the data pushing is not happening once we get more than one level deep in the collections. Here is an example: Company contains a collection of Departments -> added Departments get pushed properly to the clients as expected. Department contains a collection of Employees -> added Employees get recorded in the database BUT DONT get pushed to clients Employee contains a collection of Schedules-> added Schedules get recorded in the database BUT DONT get pushed to the clients. Currently there is only one destination for Companies which then (as I understand it) should manage it's child collections. As you can see the management seems to be working OK, but not the data pushing once we get more than one level deep in the collections. Is there something that we may be missing here in our setup or assumptions? Any ideas would help as we are on a tight schedule to finish this part of the app before the Thanksgiving break (tomorrow!!) If you need to see our code let me know and I will paste some. Of course, I am assuming that there must be a way to get data pushing to work with deeply nested collections. Thanks! - Kevin

