I added a new empty record to the datasource X. I closed the insert dialog, I go to another screen, and when trying to commit at the application level, an error is raised because the empty record is still there, and the system tries to insert it. I couldn't find a rollback or abortchanges procedure. Is there a way to formally abort changes made to a datasource?
asked 07 Sep '12, 05:40
1- If you are showing one row in the dialog
For the insert dialog, you can delete datasource row on cancel button with api_datasource.deleteRow API.
For editing an existing row, you can use datasource refreshRow APIs, in order to requery your row from its base table/view.
2- If you are showing multiple rows in the dialog
You can call api_datasource.clear api, this will delete all the rows but will not have any effect on commit.
Or, you can call api_datasource.executeQuery to get fresh data and delete/update/insert operations to the datasource will be ignored.
3- If the above solutions don't fit to your scenario
You can use api_datasource.takeSnapshot/loadSnapshot APIs in order to create and restore savepoints for your datasource data. This method may be a bit slower.
answered 07 Sep '12, 06:43
Ugur Kocak ♦
My case is the number 1 scenario, and I did exactly what you say. It works fine but I cannot say that I am happy to handle a rollback/abort operation this way. My first thought was the clear function, but any delete operation in Oracle generates a lot of data in the redo logs causing a performace penalty, especially if the database in archivelog mode. I suspect that the clear function actually delete all rows from the corresponding DSI_XXXX table.
Thank you Ugur for the fast responce.
answered 07 Sep '12, 12:08