Sunteți pe pagina 1din 21

Implementing Transactional Capabilities

Copyright 2008, Oracle. All rights reserved.


Objectives

After completing this lesson, you should be able to do the


following:
Explain ADF BC transaction handling
Implement task flow transaction control
Handle transaction exceptions
Define response to the browsers Back button
Enable save for later functionality

20 - 2 Copyright 2008, Oracle. All rights reserved.


Handling Transactions with ADF BC

Application modules handle transaction and concurrency


support.
No coding is required unless you want to customize the
default behavior.
For nested application modules, the outermost application
module provides the transaction context for the others.

20 - 3 Copyright 2008, Oracle. All rights reserved.


Default ADF Model Transactions

Database table ADF BC ADF BC ADF BC


Entity Object View Object Application Module

ADF Model
Databound components on a JSP Binding Container Data Control

20 - 4 Copyright 2008, Oracle. All rights reserved.


Transactions in Task Flows

20 - 5 Copyright 2008, Oracle. All rights reserved.


Controlling Transactions in Task Flows

20 - 6 Copyright 2008, Oracle. All rights reserved.


Transaction Support Features
of Bounded Task Flows
Back Button
Transaction:
Inherit with savepoint Support
or New Save for later

Declarative
Commit
/ Rollback

20 - 7 Copyright 2008, Oracle. All rights reserved.


Specifying Task Flow Transaction Start Options

Defining task flow transaction options:

In Property Inspector

In Structure window

20 - 8 Copyright 2008, Oracle. All rights reserved.


Specifying Task Flow Return Options

Commit or rollback must be specified for


some transactions:

You specify commit or rollback on transaction


return activities:

20 - 9 Copyright 2008, Oracle. All rights reserved.


Enabling Transactions on a Task Flow

1 2 3

4 5 6

7
8

20 - 11 Copyright 2008, Oracle. All rights reserved.


Sharing Data Controls

Data control scopes:


Shared (default): Called flow shares data control instances
with calling flow
Isolated: Called flow has unique instance of data controls

<data-control-scope>
<shared/>
</data-control-scope>

20 - 13 Copyright 2008, Oracle. All rights reserved.


Handling Transaction Exceptions

You should designate an exception handling activity on


transactional task flows.
Can be any activity type, such as:
View: To display a message
Router: To call a method depending on the type of exception

20 - 15 Copyright 2008, Oracle. All rights reserved.


Designating an Exception Handler Activity

<exception-handler>ShowError</exception-handler>
...
...
<view id="ShowError"></view>

20 - 16 Copyright 2008, Oracle. All rights reserved.


Defining Response to the Back Button

The task-flow-reentry property determines if user


can return to an exited task flow by clicking the
browsers Back button:
reentry-allowed: OK
reentry-not-allowed: Throws exception
reentry-outcome-dependent: Depends on
outcome from exited task flow
Return
to exited
task flow?

20 - 17 Copyright 2008, Oracle. All rights reserved.


Saving for Later

Quitting time Next morning


Ill work some Greatright
more on this where I
tomorrow. left off!

20 - 19 Copyright 2008, Oracle. All rights reserved.


Enabling Explicit Save for Later

Contains Calls Contains field for Restores


button that createSavePoint user to enter application state
performs save to add a savepoint- savepoint-id to and data to what
for later id pass to restore was captured in
activity savepoint-id

Save for later task flow

20 - 21 Copyright 2008, Oracle. All rights reserved.


Enabling Implicit Save for Later

To enable implicit save for later:


Change a setting in adfc-config.xml
Mark the task flow as critical

You can use the task flow editor or the Property Inspector to mark the
task flow as critical.

20 - 23 Copyright 2008, Oracle. All rights reserved.


Restoring Savepoints

A Save Point Restore activity:


Restores the state of
the application
Deletes the savepoint
from its persistence store
Optionally performs additional logic with a Save Point
Restore Finalizer
Is required in applications that are responsible for restoring
save-point-id (not necessarily the same application
that was saved for later)

20 - 24 Copyright 2008, Oracle. All rights reserved.


Setting Global Save for Later Properties

Set properties in the adfc-config.xml file:


savepoint-expiration
savepoint-manager
savepoint-datasource
enable-implicit-savepoints

20 - 26 Copyright 2008, Oracle. All rights reserved.


Summary

In this lesson, you should have learned how to:


Explain ADF BC transaction handling
Implement task flow transaction control
Handle transaction exceptions
Define response to the browsers Back button
Enable save for later functionality

20 - 27 Copyright 2008, Oracle. All rights reserved.


Practice 20 Overview:
Controlling Transactions

This practice covers the following topics:


Implementing commit functionality in the shopping cart
Adding transaction control to the checkout flow
Adding the ability to insert, update, and delete suppliers

20 - 28 Copyright 2008, Oracle. All rights reserved.

S-ar putea să vă placă și