I'm using DataServices to manage hiberate objects. I have a simple many-to-one relationship between Account and Transaction (an account has many transactions). I have two DataGrids in my application, one display accounts and their balances(which are derived from the trasactions, there is no balance field) the other displays transactions. When I edit the accounts, the changes are propogated to the child transactions. However, when I edit the transactions, the changes are not propagated to the accounts automatically. If I edit the account or resort the columns it will update the balance. My data-management-config.xml is below. My question is, is there a way to make this work or is this not working by design? I want my Account objects to automatically get the new Transactions associated with them so the balance will update correctly.
When you say "edit accounts" and "edit transactions", are you editing attributes of those objects or are you modifying relationships between them, i.e. changing the account associated with a transaction?
Also, it sounds like the problematic case is, you assign a new transaction to an account but the balance total for that account does not get automatically updated. Can you please verify that the collection field of the appropriate account is not getting updated? It is possible that the account's transaction collection is being updated correctly but there is no binding to trigger a recalculation of the balance based on that update.
There is a hierarchical-events setting which may able to solve your problem. As what you found in Ed's response, the account only has property change event when there is membership change of transactions. If your account balance is derived property which calculate the sum of the transaction. The bubble up property change event should work. If your account sum amount is calculated on the server side(trigger, stored procedure update....), you can use the DataTransaction to push the update message to the destinated account. You can also modify the transactions setter to add account as property change event listener to each transaction. When there is a change event, you can either call the getItem or recalculate your balance