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: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin
Sent: Tuesday, November 20, 2007 5:11 PM
To: flexcoders@yahoogroups.com
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