First page Back Continue Last page Graphics


Notes:

Sharing Data Controls (continued)

Interaction of transaction and data-controls-scope option settings

Setting Shared Isolated Requires Transaction Begins a new transaction if Always begins a new one is not already open transaction

Requires New Transaction Begins a new transaction if Always begins a new one is not open and throws transaction an exception if one is already open

Requires Existing Transaction Throws an exception if a Invalid: This option transaction is not already open cannot be selected at design time.

None N/A A new DataControlFrame is created without an open transaction.

Synchronizing with the Model

By default, a transaction is not committed until the task flow is exited, because that is when the DataControlFrame is committed. If you attempt to commit in the middle of the task flow, the state of the UI gets out of synchronization with the state of the model. However, you can enable a midtask flow commit by manually committing the DataControlFrame, as in the following example:

static public void saveAndContinue() {

Map sessionMap =

FacesContext.getCurrentInstance().getExternalContext().getSessionMap();

BindingContext context =

(BindingContext)sessionMap.get(BindingContext.CONTEXT_ID);

String currentFrameName = context.getCurrentDataControlFrame();

DataControlFrame dcFrame = context.findDataControlFrame(currentFrameName);

dcFrame.commit();

dcFrame.beginTransaction(null);}

FacesContext contains the information necessary for request processing, and invokes an object that executes the life cycle. BindingContext is a container object that defines a hierarchy of data controls and data binding objects derived from the Oracle ADF Model Layer. It is the handle through which the client accesses the data binding layer, and is represented by the bindings variable in EL data binding expressions.