JDeveloper 10g and Oracle ADF Business Components Getting the Most Out of Your Data - PowerPoint PPT Presentation

About This Presentation
Title:

JDeveloper 10g and Oracle ADF Business Components Getting the Most Out of Your Data

Description:

Shared heap. 100s of MB. ADF BC Bridges the Gap. SQL. Tables, rows ... Shared heap. 100s of MB. ADF BC Functionality. Reading data. Caching data. Writing data ... – PowerPoint PPT presentation

Number of Views:604
Avg rating:3.0/5.0
Slides: 46
Provided by: Ric6174
Learn more at: http://www.nocoug.org
Category:

less

Transcript and Presenter's Notes

Title: JDeveloper 10g and Oracle ADF Business Components Getting the Most Out of Your Data


1
JDeveloper 10g and Oracle ADF Business
ComponentsGetting the Most Out of Your Data
  • Avrom Roy-Faderman
  • Senior Programmer
  • November, 2005

2
Agenda
  • J2EE, ADF, and JDeveloper
  • Why Business Components?
  • Reading Data
  • Changing Data
  • Transactions
  • Demo
  • QA

3
What Is J2EE?
  • Java platform for multi-tier applications
  • Open
  • Scalable
  • Traditionally difficult to use
  • 3GL
  • Much time spent on application plumbing

4
Frameworks
  • Library of classes
  • Handle plumbing automatically
  • XML files provide customization
  • Can make Java more like a 4GL

5
ADF and MVC
  • Oracle ADF is a framework based on MVC
    architecture

View (Web and Wireless Clients)
View and Controller (Desktop Clients)
Controller (Web and Wireless Clients)
Model
Business Services
6
ADF and MVC
  • Oracle ADF is a framework based on MVC
    architecture

ADF UIX
ADF Swing
Struts ADF Extensions
ADF Data Bindings
ADF Business Components
7
Agenda
  • J2EE, ADF, and JDeveloper
  • Why Business Components?
  • Reading Data
  • Changing Data
  • Transactions
  • Demo
  • QA

8
Impedence Mismatch
  • SQL
  • Tables, rows
  • Primary keys
  • Foreign keys
  • Transactions
  • GB, TB
  • Java
  • Classes, instances
  • Memory references
  • Object members
  • Shared heap
  • 100s of MB

9
ADF BC Bridges the Gap
  • SQL
  • Tables, rows
  • Primary keys
  • Foreign keys
  • Transactions
  • GB, TB
  • Java
  • Classes, instances
  • Memory references
  • Object members
  • Shared heap
  • 100s of MB

10
ADF BC Functionality
  • Reading data
  • Caching data
  • Writing data
  • Managing relationships
  • Managing transactions

11
What they Dont Do
  • Create user interface (view)
  • Organize the flow of the application (controller)

12
Agenda
  • J2EE, ADF, and JDeveloper
  • Why Business Components?
  • Reading Data
  • Changing Data
  • Transactions
  • Demo
  • QA

13
Reading Data
  • ADF View Objects
  • ADF View Links

14
ADF View Objects
  • Retrieve data from the database
  • Manage caches of data
  • View object definitions contain SQL queries and
    act as templates for view object instances

15
ADF View Objects
  • Each view object instance can execute the SQL
    query and cache the results

View object instance
Database
SQL query
Data retrieval
Data
Data
Data
Data
Datarows
16
View Object Attributes
  • Every query column maps to a view object
    attribute
  • Those attributes are visible to the application

EmployeeId LastName DepartmentId DepartmentName
SELECT E.EMPLOYEE_ID, E.LAST_NAME,
D.DEPARTMENT_ID, D.DEPARTMENT_NAMEFROM
EMPLOYEES E, DEPARTMENTS DWHERE E.DEPARTMENT_ID
D.DEPARTMENT_ID
17
View Objects Dont Write!
  • Classes to do DML are too heavyweight if not
    needed
  • Some query columns hard to map backwards

CONCAT
COUNT


MAX
18
Reading Data
  • ADF View Objects
  • ADF View Links

19
ADF View Links
  • View link definitions relate a pair of view
    object definitions
  • View link definitions specify master/detail
    relationships between the SQL queries

20
ADF View Links
  • View link definitions have Source and
    Destination attributes
  • These attributes specify the master-detail
    relationship
  • Just like foreign key and primary key attributes
    specify a foreign key relationship

21
ADF View Links
  • A view link definition works like an additional
    WHERE clause applied to the detail

Source attribute
SELECT E.EMPLOYEE_ID, E.LAST_NAMEFROM
EMPLOYEES E
EmployeesView(Master)
Destination attribute
SELECT D.DEPARTMENT_ID, D.DEPARTMENT_NAME,
D.MANAGER_IDFROM DEPARTMENTS D
DepartmentsView(Detail)
WHERE D.MANAGER_ID 1
22
Agenda
  • J2EE, ADF, and JDeveloper
  • Why Business Components?
  • Reading Data
  • Changing Data
  • Transactions
  • Demo
  • QA

23
Changing Data
  • ADF Entity Objects
  • View and Entity Attributes

24
ADF Entity Objects
  • Entity object definitions correspond to
    database tables.
  • Entity object definitions are templates for
    entity object instances, which correspond to
    table rows.

25
View Objects and Entity Objects
  • Instead of caching data themselves, view object
    instances can store data in entity object
    instances

View object instance
SQL query
Database
Data retrieval
Data
Data
Data
Datarows
26
View Objects and Entity Objects
  • The entity object instances can write back to the
    database
  • Entity object definitions can specify validation
    rules

View object instance
Database
DML
Data
Data
Data
Datarows
27
Entity Object Attributes
  • Every table column maps to an entity object
    attribute

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY ...




EmployeeId FirstName LastName Salary
28
Changing Data
  • ADF Entity Objects
  • View and Entity Attributes

29
View and Entity Attributes
  • Every view object attribute can map to an entity
    attribute

EmployeeId LastName DepartmentId DepartmentName
EmployeeId FirstName LastName DepartmentId
30
One View, Many Entities
  • One view object definition can map to multiple
    entity object definitions

DepartmentId DepartmentName ManagerId LocationId
EmployeeId LastName DepartmentId DepartmentName
EmployeeId FirstName LastName DepartmentId
EmpDeptView
Departments
Employees
31
One View, Many Entities
  • Then each view row will map to multiple entity
    object instances

Data
Data
Data
Data
Viewrows
Departments
Data
Data
Data
Data
Data
Data
Data
Data
Entity objectinstances
Entity objectinstances
Employees
32
One Entity, Many Views
  • Multiple view object definitions can map to a
    single entity object definition

DepartmentId DepartmentName LocationId LocationNam
e
DepartmentId DepartmentName ManagerId LocationId
EmployeeId LastName DepartmentId DepartmentName
DeptLocView
EmpDeptView
33
One Entity, Many Views
  • Then different view object instances can share
    data

Data
Data
Data
Data
Data
Data
Data
Data
Viewrows
Viewrows
DeptLocViewinstance
EmpDeptViewinstance
Data
Data
Data
Data
Entity objectinstances
34
SQL-Only View Attributes
  • View attributes dont need to map to entity
    attributes at all
  • Then they must be read-only
  • E.g. Caclulated query columns

35
Read-Only View Objects
  • Have only SQL-Only attributes
  • Do not use entity objects at all
  • Read-only access to data
  • But

Much faster!
36
Agenda
  • J2EE, ADF, and JDeveloper
  • Why Business Components?
  • Reading Data
  • Changing Data
  • Transactions
  • Demo
  • QA

37
Application Modules
  • Application modules package up the data and
    present it to the rest of the application
  • The application always talks to the business
    components through the application module

38
Application Module Instances
  • Each instance (user) of the application will get
    its own application module instance
  • The application module instance contains view
    object instances
  • View object instances use entity object instances
    to write

39
The Data Model
  • The view object instances in an application
    module instance are joined in master-detail
    relationships by view link instances
  • The resulting tree is called the data model

40
A Simple Data Model
Instance ofEmployeesView
SELECT E.EMPLOYEE_ID, E.LAST_NAMEFROM
EMPLOYEES E
SELECT D.DEPARTMENT_ID, D.DEPARTMENT_NAME,
D.MANAGER_IDFROM DEPARTMENTS D
Instance ofDepartmentsView
WHERE D.MANAGER_ID current_employee_id
Instance of DeptMgrLink
41
A More Complex Data Model
IndependentInstance ofDepartmentsView
MasterInstance ofEmployeesView
DetailInstance ofDepartmentsView
DetailInstance ofEmployeesView
42
Application Module Definitions
  • Templates for application module instances
  • Specify which view object and view link instances
    should go in the data model

43
Data Consistency
  • Each application module instance has its own set
    of view and entity caches
  • Two locking mode choices
  • Pessimistic locks (the default) acquired on DB
    rows as soon as data is changed in the cache
  • Optimistic locks acquired just before executing
    DML

44
Demo
45
Q A
Write a Comment
User Comments (0)
About PowerShow.com