When you execute the fill on the data service, you should pass the arrray collection to the fill e.g. myDataService.fill(collection, ...). When you add the item to this "managed" array collection, the create-item will get called with just the the _newly added item_, and the insert SQL executed for it on the server side.
Yes, Rohit, I know all that. Seems I missed mentioning some information or maybe I just wasn't clear enough.
I can fill the arraycollection correctly by calling the fill method. I can add the item to the database by adding the new item to the arraycollection which executes the insert query.
The problem is that after the insert query is executed, my application seems to take a long time "returning" from that query. For example, after a customer is added, the user can go through and edit other items about that customer like their address. If the user edits the customer too soon (before the query returns), the primary key on the customer does not have a value so therefore I cannot use an update query on that customer yet.
When I look at my server when the insert is executed, I see all the customers scrolling like they are being retrieved from the database again. Is there a way to quickly add one item to the database and quickly get that item back without having to wait for the fill itself to refresh?
1 person found this helpful
Well, one option is to set autoCommit = false on the data service, and explicitly call invoke commit on Data Service, when you are finished "cooking" the item.
I believe, by default SQLAssembler, has autoRefreshFill(...) == true, and uses the default refreshFill(...) implementation, which results in the fill being rexecuted. You might want to extend from the assembler, as per your needs. Refer to the documentation
Thank you for your response! I will have to look into how to do that.