Saturday, January 25, 2014

How to find Dirty Transaction check in Backing Bean

This blog explains about getting Application Module instance in backing bean and finding whether there is dirty transaction or not.


// Below code is used to get the Application Module instance in backing bean using DC Iterator bindings. This is best way of getting AM Instance in backing bean, This is not going to create a new AM instance.

        DCBindingContainer bindings =
            (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DataControl dc =
            bindings.findDataControl("EmployeeServiceDataControl");
        ApplicationModuleImpl am =
            ((ApplicationModuleImpl)dc.getDataProvider());  

// EmployeeService - This is application module name.  
// Below code is used to determine whether there is any dirty transaction data or not.
                  boolean isDirty =am.getDBTransaction().isDirty();


No comments:

Post a Comment