Date post: | 11-Nov-2014 |
Category: |
Technology |
Upload: | chris-muir |
View: | 190 times |
Download: | 1 times |
1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Task Flow Data Control Scope Options
ORACLE PRODUCT
LOGO
Real World ADF Design & Architecture Principles
15th Feb 2013 v1.0
3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Learning Objectives
• At the end of this module you should be able to:
– Understand how the traditional concept of transactions aligns to that of ADF
– Identify different data controls and their transaction capabilities – Explain the influence of the task flow data control scope option
and how it relates to data controls
Image: imagerymajestic/ FreeDigitalPhotos.net
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Transactions Revisited • ADF Data Controls • Task Flow “Data Control Scope"
5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
In terms of database systems what is a transaction? Why are they needed?
In ADF where are the transactional capabilities defined?
Exercise
Image: imagerymajestic/ FreeDigitalPhotos.net
6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Transactions Revisited
• The common definition
– A collection of work with a start and end – Commit or rollback acts on the entire collection of work – If an errors occur we don’t get stuck half way
– Other users are isolated from the transactions – Only future transactions see the results
7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Transactions – What You Forgot
• Remember transactions aren’t just about commit and rollback
– They allow one user to chain operations together – Not just separate atomic actions – Each operation sees the previous changes within the transaction – Not visible to other users, but are visible to the current user – As such transactions are also a form of state management
8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Where in ADF are the transactional capabilities
exposed (defined) to the UI layer again?
Exercise
Image: imagerymajestic/ FreeDigitalPhotos.net
9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Transactions & Data Controls
• Data controls provide the transactional APIs in ADF – Remember this isn’t just commit and rollback – But also state management
• Typically one instance is given to each user session – This separates users’ transactions
• Dependent on design – A user can be given multiple instances to perform multiple
transactions
10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Program Agenda
• Transactions Recap • ADF Data Controls • Task Flow “Data Control Scope"
11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Data Controls Types
• ADF BC • EJB/JPA • POJO • RESTful/URL • SOAP/Web service • Custom data controls
All designed to carry state
EJB/JPA out-of-the-box uses an implicit commit
model
Only ADF BC supports explicit commit &
rollbacks
12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Data Controls Challenges • If transactions are logically mapped to navigating groups of web pages
– Q: How do we map the data control transaction to these boundaries?
• If we need to support separate transactions per session – Q: How do we configure this with just one data control?
• If ADF libraries may split data control definitions – Q: How to combine @ runtime with one instance and they can share state?
• If our application uses multiple different data control types – Q: How to commit/rollback as a group?
13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Data Controls Challenges & Solutions • If transactions are logically mapped to navigating groups of web pages
– Q: How do we map the data control transaction to these boundaries? – A: Task flows allow you to define groups of pages/fragments and task flows
• If we need to support separate transactions per session – Q: How do we configure this with just one data control? – A: Task flows can create a new data control or share an existing one
• If ADF libraries may split data control definitions – Q: How to combine @ runtime with one instance and they can share state? – A: Intelligence is built in to combine data controls at runtime
• If our application uses multiple different data control types – Q: How to commit/rollback as a group? – A: Task flows track the data controls attached as a group
14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Data Controls Challenges & Solutions • If transactions are logically mapped to navigating groups of web pages
– Q: How do we map the data control transaction to these boundaries? – A: Task flows allow you to define groups of pages/fragments and task flows
• If we need to support separate transactions per session – Q: How do we configure this with just one data control? – A: Task flows can create a new data control or share an existing one
• If ADF libraries may split data control definitions – Q: How to combine @ runtime with one instance and they can share state? – A: Intelligence is built in to combine data controls at runtime
• If our application uses multiple different data controls – Q: How to commit/rollback as a group? – A: Task flows track the data controls attached as a group
Answered in the previous presentations
15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Data Controls Challenges & Solutions • If transactions are logically mapped to navigating groups of web pages
– Q: How do we map the data control transaction to these boundaries? – A: Task flows allow you to define groups of pages/fragments and task flows
• If we need to support separate transactions per session – Q: How do we configure this with just one data control? – A: Task flows can create a new data control or share an existing one
• If ADF libraries may split data control definitions – Q: How to combine @ runtime with one instance and they can share state? – A: Intelligence is built in to combine data controls at runtime
• If our application uses multiple different data controls – Q: How to commit/rollback as a group? – A: Task flows track the data controls attached as a group
Answered in the this presentation
16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Data Controls Challenges & Solutions • If transactions are logically mapped to navigating groups of web pages
– Q: How do we map the data control transaction to these boundaries? – A: Task flows allow you to define groups of pages/fragments and task flows
• If we need to support separate transactions per session – Q: How do we configure this with just one data control? – A: Task flows can create a new data control or share an existing one
• If ADF libraries may split data control definitions – Q: How to combine @ runtime with one instance and they can share state? – A: Intelligence is built in to combine data controls at runtime
• If our application uses multiple different data controls – Q: How to commit/rollback as a group? – A: Task flows track the data controls attached as a group
Answered in the next presentation
17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Task Flow Transaction and Data Control Scope Options
<?xml version="1.0" encoding="ISO-8859-1" ?> <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2"> <task-flow-definition id="task-flow-definition"> <transaction> <new-transaction/> </transaction> <data-control-scope> <isolated/> </data-control-scope> <use-page-fragments/> </task-flow-definition> </adfc-config>
18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Shared Data Control Scope
• “Share data controls with calling task flow” • Shared
– Between calling & called task flows – If data controls are of the same
name and type – Only one instance of the data
control will be created & shared – And view objects sharing:
• Current row indicators • Edit the same records • One database connection
19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Isolated Data Control Scope
• Don’t’ “Share data controls with calling task flow” • Isolated
– Regardless two instances of the data control
– Allows disparate data control transactions
– Separate view objects • No record coordination • Isolated record editing • Separate connections
20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Our system provides the user access to two isolated instances of the same data control simultaneously, and we're now infrequently
hitting row lock errors.
Why and what’s the solution?
Exercise
Image: imagerymajestic/ FreeDigitalPhotos.net
21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Shared Data Control Scope: To
2
1
3
4
22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Shared Data Control Scope: Returning
1 3 4
2
23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Isolated Data Control Scope: To
1
2
4 3
24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Isolated Data Control Scope: Returning
25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Isolated Data Control Scope: Returning
1 2
4
5
3 6
26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Image: Ambro / FreeDigitalPhotos.net
Every isolated task flow means separate data control instances, more memory consumed, and if using ADF BC more database
connections consumed.
27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Rules for Sharing Data Controls
• Data control must be in same data control frame • Same data control type – eg. ADF BC, EJB, WebService • Across ADF Libraries
– At design time if same data control comes from two different ADF libraries, if they have the same name they can also share
28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Conclusion
• The data control scope allows task flows to share or create separate instances of data controls
• If shared they will share a transaction and state • If isolated they will have their own transaction and state • Isolated makes sense when parts of the application state must
be kept separate and independent – But does have an overhead of extra memory and (for ADF BC) database
connections – And you lose sharing state (such as current iterator positions) across
separate instances of the same view object
29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Further Reading
Essential to view the next slides on Task Flow Transaction Options
30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.