Last item added shows up as a duplicate when closing and reopening adobe air app using lcds
I am running into an issue when trying to mimic the adobe crm tutorial provided with the LCDS install.
Basically, I am able to add items to my arraycollection, which magically in turn is utilizing my dataService and calling my custom assembler .createItem. It then calls update collection and my view updates in the Air App with the correct id and information (believe it's delegating to my .fill method in my assembler).
However, if i add multiple items, and then close my Adobe Air Application, when i open it back up, i have a duplicate of the last entry i added (one item in the datagrid has the correct id populate by the Database, the other id is the default value of the ID of the actionscript VO object - which i'm assuming is a local cached instance of the object in the sqllite database).
Any insight on this problem would be useful.
It's almost as if after the immediate createItem is called, it's not synching the local cached instance of the object serialized in the sqllite db with what was created on the back-end. Something else is being called (perhaps the fill) that is synching every previous item created but not the last one.
I'm using LCDS, Apache Tomcat 6, Java/Spring back-end, and SqlServer DB.
Thanks in advance,
Also to note, i checked out the CRM air tutorial that is packed with the lcds-samples deployment, and it has the same symptom whenever you only open the app, add one item, close the app, and reopen. It'll have a company listed with the ID generated from the server, and then it will also have a company with the same information with a companyId of 0 in the datagrid.
The problem is that the commit does not finish before the cache is saved when using autoCommit and autoCache. It's best to disable these and handle it manually. However, when you handle it manually, make sure that you use the Async responders or you will run into the same problem. ie., only on a successfully commit should you fill and save the cache.