Checking Transaction Status of DataControl for Dirty/Modified transaction in ADF

Sharing is Caring

Sometimes we need to check the status of datacontrol  transaction, when we have any form or table on the page, initially transaction is not dirty (it means there are no pending changes in the binding layer)

If the user changes any data set on the page that is populated from ADF binding layer, the status of the transaction is modified as now there are pending changes on the page.

When the user performs commit or rollback operation then again transaction status changes.

So it is necessary to have the basic understanding of Transaction Status and using this we can write some better piece of codes.
Example- suppose we have a save button in our Application that performs commit operation when the user clicks on that button, every time commit gets executed but logically if there is no change in the binding layer then commit must not be executed.
So we can check transaction status on this button and if there are any pending changes in ADFm binding layer or transaction is dirty only then commit will be executed.

  • I have created a sample application to check this, there is departments and location ViewObjects are on the page and a button to check transaction status
  • Code to check transaction status-

public BindingContainer getBindings(){
        return BindingContext.getCurrent().getCurrentBindingsEntry();
    }

DCBindingContainer dcbind =(DCBindingContainer)getBindings();
dcbind.getDataControl().isTransactionModified()


OR

amObject.getDBTransaction().isDirty()

 

  • Initially see page status there is no pending changes so the transaction is not dirty

 

 

DataControl
  • Now I have changed DepartmentName attribute, then clicked on Check Transaction button

 

  • Now when data is committed again status got changed

Cheers 🙂 Happy Learning

Related Posts

I’m an Oracle ACE, Blogger, Reviewer,
Technical Lead working on Oracle ADF

0 thoughts on “Checking Transaction Status of DataControl for Dirty/Modified transaction in ADF”

  1. Hi Ashish,

    I have Nested Application Module i.e RootAM –> AM1 and AM2.
    I need to check if there are any pending changes in AM1 or AM2 separately.
    With the above described method, it will check only for RootAM.

    Could you please help.

    Thanks in advance.

    Regards,
    Manoj

Leave a Reply

Your email address will not be published. Required fields are marked *