Thursday, March 06, 2008

ADF:Save And Continue functionality ina taskflow.

When a bounded task flow manages a transaction (marked as requires-transaction,
requires-new-transaction, or requires-existing-transaction), then the
task flow must issue any commits or rollbacks that are needed. This is
essentially to keep the state of the transaction that the task flow understands
in synch with the state of the transaction in the ADFbc layer.

Use this method to issue a commit in the middle of a task flow while staying
in the task flow.


public static void saveAndContinue() {
java.util.Map sessionMap =
FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
oracle.adf.model.BindingContext context =
(oracle.adf.model.BindingContext)sessionMap.get(
oracle.adf.model.BindingContext.CONTEXT_ID);
String currentFrameName = context.getCurrentDataControlFrame();
oracle.adf.model.DataControlFrame dcFrame =
context.findDataControlFrame(currentFrameName);

dcFrame.commit();
dcFrame.beginTransaction(null);
}