thanks for the suggestions. I made the changes and was able to get
some basic pushing working, but it seems very "touch and go" as to
when it works and when it doesn't. I don't know if this is related
to our data management configuration or something larger.
For example, on my local dev server, I can load the app on two
different screens and get the pushed data to work, but only one way.
However, if I keep reloading the app in the browser, I can eventually
get to a place where it works both ways. I have also try to upload
it to a production server, but I can't seem to get that to work at
all even though the database is getting updated fine so the
destinations are obviously working. I should mention that we are
using Tomcat 5.5.
Is there a way to debug & test data pushing to try to isolate the
reasons. Also, is there a way to restore it should the connections
get lost AND thus what is the best way to catch these lapses and
attempt to restore the connection. The problem I am having now is
that unless I am monitoring two screens, there is no way I would know
what is getting pushed to clients and what isn't
I am obviously, very green with this, but since we have gotten this
far with this app, I would like to see it through rather than go back
to polling for data through remoting calls.
Thanks for the help. I really appreciate it!
- Kevin
On Nov 21, 2007, at 12:10 AM, Jeff Vroom wrote:
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