Expand my Community achievements bar.

Managed association commit order

Avatar

Level 1
I am in the process of implementing a managed association for
a person with many addresses. The association seems to work for all
my test cases, except when I create a person with an address (at
the same time). It attempts to create the address before the
person, which means the foreign key to the person isn't set since
the person hasn't been created. If I save the person first (without
an address) and then add the address, it works as expected. Updates
and deletes also work.



I have setup the following:

- In the data-management-config.xml I have a destination for
the person with a one-to-many reference to the address.

- The address and person classes both have the [Managed] tag.

- A DataService for the person points to the person
destination.



I have stepped through the save in debug mode, and can see
that after the commit() command on the person DataService there is
a "call" variable that contains an array of
mx.data.messages.DataMessages. The first position of the array
points the address destination (the child), and the second points
to the person destination (the parent).



How do I get the parent destination to go first?
0 Replies