Oracle ADF Architecture TV - Design - Architecting for PLSQL Integration

Post on 11-Nov-2014

234 Views

Category:

Technology

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

Slides from Oracle's ADF Architecture TV series covering the Design phase of ADF projects, considering integrating PLSQL into your ADF applications. Like to know more? Check out: - Subscribe to the YouTube channel - http://bit.ly/adftvsub - Design Playlist - http://www.youtube.com/playlist?list=PLJz3HAsCPVaSemIjFk4lfokNynzp5Euet - Read the episode index on the ADF Architecture Square - http://bit.ly/adfarchsquare

Transcript

1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Real World ADF Design & Architecture Principles Architecting for PL/SQL Integration

ORACLE PRODUCT

LOGO

15th Feb 2013 v1.0

3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Learning Objectives

•  At the end of this module you should be able to:

– Understand all options for integrating PL/SQL into your ADF applications

–  Identify problem areas with global variables and pending transactions

– Be able to implement best practices PL/SQL access from ADF business services and clients

Image: imagerymajestic/ FreeDigitalPhotos.net

4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components •  ADF and Database Triggers •  Summary & Best Practices

5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

How PL/SQL is used in existing applications

•  Core Data Access Layer (Table API) –  Data protection layer that encapsulates mostly DML operations –  Select (database views) –  DML through PL/SQL packages

•  Application Business Component Layer –  PL/SQL package for application specific data access –  Also used to convert PL/SQL types to supported Java types –  Uses the Table API for CRUD

•  Validation and aggregation –  Implemented in PL/SQL procedures or functions

6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Motivation for PL/SQL in Java

• Why do customers want to integrate PL/SQL into Java? –  Language Reasons – Data Protection Reasons –  Legacy Application Reasons

7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Motivation for PL/SQL in Java

•  PL/SQL is "the language" of the Oracle database •  Is highly integrated with SQL •  Platform and operation system agnostic as it’s executed in the

database –  Simplifies upgrade and migration of an application

•  There’s no need to write data to the middle tier to perform business operations on them

•  Oracle customers often have a PL/SQL programming background –  Procedural vs. Object Oriented Programming

Language Reasons

8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Motivation for PL/SQL in Java

•  Integrates well with database security –  PL/SQL participates in database role based security

•  DML operations may trigger calls to PL/SQL •  PL/SQL APIs to database tables ensure data integrity independent

of the client used to connect to the database schema •  Data that is not queried from the database cannot be stolen or

manipulated in transit

Data Protection Reasons

9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Motivation for PL/SQL in Java

•  Oracle Forms customers used PL/SQL packages to hold business logic as per Oracle Forms recommended best practices

•  Oracle RDBMS, Forms and Designer customers have built large numbers of PL/SQL packages in the past –  A project to re-develop the logic in Java is considered expensive and error-prone

•  "Never Change a Winning Team" –  Some PL/SQL applications have gone through acceptance testing or statutory

approval processes

•  Even large PL/SQL migration projects required PL/SQL and Java to be used in parallel

Legacy Application Reasons

10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Should PL/SQL be used within Java EE applications? Please advise.

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components •  Summary & Best Practices

12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

SQL Data Type – Java Mismatch

•  PL/SQL and SQL data types differ from Java types •  SQL data types need to be mapped to Java types and vice versa

•  Java DB Connectivity (JDBC) limitations –  No support for Record Types –  No support for %rowtype and table of %rowtype –  Boolean data type doesn't exist in RDBMS

•  Java uses connection pooling for better performance –  Users share a schema and don't have a 1-1 database connect relation –  Global package variables wont work

13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components •  ADF and Database Triggers •  Summary & Best Practices

14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF Design Considerations for PL/SQL

•  Tables are accessed by PL/SQL packages

•  If possible –  Consider a PL/SQL data access package

per table for ease of development and maintenance

–  Use application specific PL/SQL packages as an abstraction layer within the database

PL/SQL Data Access Layer Database

PL/

SQ

L P

L/S

QL

PL/

SQ

L

Create, update, delete

Create, update, delete

Create, update, delete

App

licat

ion

Spe

cific

PL/

SQ

L

15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF Design Considerations for PL/SQL Overall Oracle Forms, ADF Architecture Choice

Database

PL/

SQ

L P

L/S

QL

PL/

SQ

L

Create, update, delete

Create, update, delete

Create, update, delete

App

licat

ion

Spe

cific

PL/

SQ

L

Oracle Forms

16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF Design Considerations for PL/SQL Overall Oracle Forms, ADF Architecture Choice

Database

PL/

SQ

L P

L/S

QL

PL/

SQ

L

Create, update, delete

Create, update, delete

Create, update, delete

App

licat

ion

Spe

cific

PL/

SQ

L

ADF Client

Oracle Forms

Native Java Access

17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF Design Considerations for PL/SQL Overall Oracle Forms, ADF Architecture Choice

Database

PL/

SQ

L P

L/S

QL

PL/

SQ

L

Create, update, delete

Create, update, delete

Create, update, delete

App

licat

ion

Spe

cific

PL/

SQ

L

SO

AP

Ser

vice

s R

ES

T S

ervi

ces

ADF Client

Oracle Forms

Native Java Access

18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF Design Considerations for PL/SQL Overall Oracle Forms, ADF Architecture Choice

Database

PL/

SQ

L P

L/S

QL

PL/

SQ

L

Create, update, delete

Create, update, delete

Create, update, delete

App

licat

ion

Spe

cific

PL/

SQ

L

SO

AP

Ser

vice

s R

ES

T S

ervi

ces

ADF Client

Oracle Forms

Web Service Layer

Native Java Access

19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF Design Considerations for PL/SQL Overall Oracle Forms, ADF Architecture Choice

Database

PL/

SQ

L P

L/S

QL

PL/

SQ

L

Create, update, delete

Create, update, delete

Create, update, delete

App

licat

ion

Spe

cific

PL/

SQ

L

SO

AP

Ser

vice

s R

ES

T S

ervi

ces

ADF Client

Oracle Forms

ADF BC

Web Service Layer

Native Java Access

20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components

–  PL/SQL Table API –  PL/SQL Read Access –  PL/SQL Function Calls

•  ADF and Database Triggers •  Summary & Best Practices

21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Not to bore you with a too lengthy presentation, in the following PL/SQL integration is explained for ADF BC only. Note that TopLink (EclipseLink) integration is similar and patterns and recommendations apply

Image: Ambro/ FreeDigitalPhotos.net

22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL in ADF BC ADF BC Architecture

Application Module

View Object

Entity Object

1 *

Data Model XML Definition

View Object Base Class

XML Definition

Entity Object Base Class

References References

XML Definition

AM Base Class

References

23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components

–  PL/SQL Table API –  PL/SQL Read Access –  PLSQL Calls from View Layer

•  ADF and Database Triggers •  Summary & Best Practices

24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF BC

•  ADF Business Components can be created based on database views and tables for read

•  Override the entity doDML method to perform entity insert, update and delete operations using PL/SQL

•  Optionally override the lock and findByPrimaryKey methods

•  Best Practice: Create a custom PLSQLEntityImpl class that extends the ADF BC EntityImpl class and use it as the base class for all PL/SQL entity classes

PL/SQL as Table API

25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML)

•  Implementation –  Create ADF BC entity based on database table or view –  Create entity Impl class –  Override doDML to call PL/SQL procedures

•  Use when –  You only have very few entities that require to call PL/SQL when inserting,

updating or deleting data rows

•  Consider –  Application wide generic entity base class for common PL/SQL related boilerplate

code

No Reuse Implementation

26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) No Reuse Implementation

Entity Object

XML Definition

Custom EntityImpl

References

Entity Object Base Class

Extends

27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) No Reuse Implementation

28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) No Reuse Implementation

Entity Object

XML Definition

Custom EntityImpl

References

Entity Object Base Class

Extends

29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) No Reuse Implementation

View Object

Entity Object

1 *

XML Definition

Custom EntityImpl

References

Entity Object Base Class

Extends

Overrides

protected void doDML(int operation, TransactionEvent e) { if (operation == DML_INSERT) callInsertProcedure(e); else if (operation == DML_UPDATE) callUpdateProcedure(e); else if (operation == DML_DELETE) callDeleteProcedure(e); }

30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF BC Framework Custom

PL/SQL as Table API (DML) Advanced Implementation (Reuse)

Entity Object

XML Definition

references PlsqlEntity Base Class

Entity Object Base Class

PlsqlEntityDef Base Class

EntityDef Object Base Class

References

extends

extends

Custom Properties set enter

31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

About the Sample

•  Sample is an implementation of Avrom Faderman blog entry –  http://www.avromroyfaderman.com/2008/07/the-power-of-properties/

•  Idea is to leverage entity object and attribute custom properties to parameterize generic framework classes

•  The EntityDefImpl class loads properties for the insert, update and delete argument lists –  Arguments are attributes of the entity that are configured with an index number to indicate the

argument position in the stored procedure call

•  DefImpl class reads procedure names from custom properties on the entity •  EntityImpl class uses the infromation in the DefImpl class to invoke the PL

\SQL procedure

Before Showing the Screen Shots

32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML)

•  Import your ADF library that contains the ADF BC PL/SQL Framework Extension

•  Create entity object and view object based on database view or table

•  Override default ADF BC entity and entityDef class

•  Configure custom properties on entity object and attribute

Advanced Implementation: Reference Libraries

33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) Advanced Implementation: Override Entity Base Classes

<Entity xmlns="http://xmlns.oracle.com/bc4j" Name="Departments" … RowClass="sample.fmwext.PlSqlEntityBaseImpl" DefClass="sample.fmwext.PlSqlEntityBaseDefImpl"> <DesignTime> <Attr Name="_superClass" Value="sample.fmwext.PlSqlEntityBaseImpl"/> <Attr Name="_defSuperClass" Value="sample.fmwext.PlSqlEntityBaseDefImpl"/> </DesignTime> <Attribute ...

Departments.xml

34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) Advanced Implementation: Custom Properties

35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) Advanced Implementation: Custom Entity Properties

36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML) Advanced Implementation: Custom Attribute Properties

37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL as Table API (DML)

•  Use when –  You have a lot of PL/SQL APIs to integrate in ADF –  Declarative solution is preferred over coding solution –  You have developers with limited or no Java knowledge

•  Consider –  Always use application wide generic fmwk entity base class for common entity

related boilerplate code (recommended as ADF BC best practice) –  ADF is not a runtime container for PL/SQL. Use PL/SQL by exception

Advanced Implementation (Reuse)

38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components

–  PL/SQL Table API –  PL/SQL Read Access –  PLSQL Calls from View Layer

•  ADF and Database Triggers •  Summary & Best Practices

39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Secret of ADF Rockstar Programmers

"Ideally you always read data from database tables or -views using SQL queries"

40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

View based on PL/SQL Function

•  Implementation –  Create view object Impl class –  Override the ViewObjectImpl methods to read data from PL/SQL

•  create() •  executeQueryForCollection() •  hasNextForCollection() •  createRowFromResultSet() •  getQueryHitCount()

•  Consider –  Generic view object impl class for common PL/SQL code

"No Reuse" Implementation

41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

View based on PL/SQL Function "No Reuse" Implementation

View Object

XML Definition

Custom ViewObjectImpl

References

ViewObject Base Class

Extends

42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

View based on PL/SQL Function "No Reuse" Implementation

protected void create(){ … getViewDef().setQuery(null); getViewDef().setSelectClause(null); } protected void executeQueryForCollection(){…} protected boolean hasNextForCollection(){…} protected ViewRowImpl createRowFromResultSet(){…} protected long getQueryHitCount(){…}

View Object

XML Definition

Custom ViewObjectImpl

References

ViewObject Base Class

Extends

43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Methods Explained

•  executeQueryForCollection() –  Executes the PL/SQL statement –  Calls setResultSetForCollection to store SQL result set as the user data for this

View Object •  createRowFromResultSet()

–  Called to copy row in user data to ViewRowImpl instance –  Calls populateAttributeForRow(...) for each attribute to add to new row –  Converts SQL Types in Result Set to ADF BC attribute types

•  getQueryHitCount() –  Calls PL/SQL procedure determining the number of rows to fetch for a query –  Used by ADF BC getEstimatedRowCount method

What You Need To Implement

44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

ADF BC Framework

View based on PL/SQL Function Advanced Implementation (Reuse)

references PlsqlViewObject Base Class

View Object Base Class

PlsqlViewDef Base Class

ViewDef Object Base Class

References

extends

extends

Custom Properties set enter

Custom

View Object

XML Definition

45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL Based Programmatic View Object

•  Implementing parent-child relationship between programmatic views –  Create ViewLink between parent and child view –  Map parent PK VO attribute to child FK VO attribute –  ViewLink defines BIND_<ATTRIBUTE NAME> bind variable –  Bind variable is passed as Object[] params argument to executeQueryForCollection method • Override method in custom VO IMPL class

–  "params" is an Array of Array[2] •  [0] name •  [1] value

–  Read bind variable and use in programmatic view object data query

Implementing Parent – Child Relationships

46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

How can I update PL/SQL function based view objects?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components

–  PL/SQL Table API –  PL/SQL Read Access –  PLSQL Calls from View Layer

•  ADF and Database Triggers •  Summary & Best Practices

48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Calling PL/SQL From ADF Faces

•  Expose Java method invoking PL/SQL on the Application Module or View Object client interface

•  Create a method binding in PageDef file •  Use OperationBinding to invoke method binding in binding layer

–  Method arguments passed in declaratively (binding layer) or programmatically (Java)

Managed Bean

49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Repeat after me 1000 times:

Always work through the binding layer Always work through the binding layer Always work through the binding layer

….

Image: Ambro / FreeDigitalPhotos.net

50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Calling PL/SQL From ADF Faces Architecture Diagram

Database

PL/

SQ

L

Func

tion Read, or Create,

or Delete

Application Module

Data Model

AM Impl public void invokePlSQL()

AM Client Interface public void invokePlSQL()

PageDef

method binding

Managed Bean

Button

51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Got it! But how do you call PL/SQL from a task flow method activity?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Anything to consider in regards to ADF BC application module pooling and associated

activation / passivation cycles?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

53 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components •  ADF and Database Triggers •  Summary & Best Practices

54 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Database Updates in ADF BC

•  Entity objects are bound to database views and tables •  Entities handle data insert, update and delete operations •  View objects with no entity association are read-only •  Views based on entities read data from entity cache

–  Cache holds queried and updated data objects –  If a field should refresh upon entity row update, then this value is returned from

the update statement with no extra query required

Entities and Entity Field Refresh

55 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Database Triggers With ADF BC Example: Update through Database Row Level Triggers

CREATE OR REPLACE TRIGGER EMPLOYEE_BEFORE_UPDATE BEFORE UPDATE ON EMPLOYEES FOR EACH ROW when ((NEW.SALARY is not null) AND (NEW.SALARY <> OLD.SALARY)) BEGIN if (:NEW.SALARY > 5000) THEN :NEW.COMMISSION_PCT := 0.25; ELSE :NEW.COMMISSION_PCT := 0.5; END IF; END;

56 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Database Triggers With ADF BC Example: Update through Database Row Level Triggers

BEGIN UPDATE EMPLOYEES Employees SET SALARY=:1 WHERE EMPLOYEE_ID=:2 RETURNING COMMISSION_PCT INTO :3; END;

57 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Motivation for PL/SQL in Java •  SQL Data Type - Java Mismatch •  ADF Design Considerations for PL/SQL •  Integrating PL/SQL in ADF Business Components •  ADF and Database Triggers •  Summary & Best Practices

58 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL in ADF

•  Remember not all PL/SQL is suitable for integration –  Many PL/SQL routines were written over 10 years ago –  Used by many different systems interfacing into the database –  Have been maintained by extended generation of programmers –  Are brittle in terms of how they are used –  Any slight change to suit new functionality required by your ADF application can have ongoing

impacts –  Do silly things like issue database commits/rollbacks in the middle of the transactional

processing, which is undesired by ADF applications

•  PL/SQL integration should be implemented such that you can later easily replace calls to PL/SQL with equivalent Java calls

Setting Expectations Right

59 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL in ADF

•  Java EE uses connection pooling –  ADF application doesn't connect to individual database user accounts –  Database user session is not kept between request –  Database doesn't share ADF web session

•  Database functionality like label security need to get user context injected with each request

•  ADF BC view object and entity caches don't synchronize with data changes applied in database

•  A commit performed in PL/SQL is not recognized by ADF BC •  Locking behavior of ADF BC and PL/SQL may conflict

Setting Expectations Right

60 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL in ADF

•  ADF is not Oracle Forms –  Recommendations for best practices in ADF differ from those in Oracle Forms

•  Oracle Forms recommended best practice is to store business logic in the database –  PL/SQL is the programming language of Oracle Forms –  Oracle Forms does not have the option to extend or reuse data blocks

•  To protect tables from direct Forms access you need to use PLSQL as a table wrapper

•  Java EE has different ways to handle "Forms" problems

Addressing Oracle Forms Best Practices

61 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

PL/SQL in ADF

•  Using PL/SQL in Oracle ADF doesn't turn Oracle Forms into Oracle ADF developers –  Same for PL/SQL application developers –  Use PL/SQL for integration and while migrating applications towards Oracle ADF –  At the same time prepare for a Java based substitution of PL/SQL where possible

•  Allow Oracle Forms and PL/SQL application developers to learn Oracle ADF –  Learn Oracle ADF properly before making any decision about how to migrate –  Forms to Oracle ADF integration is not easy and not straight forward. Don't

underestimate the effort

Addressing Oracle Forms and PLSQL Application Migration

62 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Conclusion I/II

•  Separate PL/SQL Java logic from application logic –  Create

•  PLSQL Java util classes –  Wrap calls to PL/SQL by exposing methods for the most

common use cases (e.g. Stored procedures calls having up to 3 arguments)

•  Base PL/SQL entities •  Base PL/SQL view objects

•  Enable custom entity and view implementation classes for configuration through properties

63 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Conclusion II/III •  Refactor your code up in the Java call hierarchy if it is

generic so it can be reused •  Refactor code into helper classes if it can be used on

all layers •  Fix PL/SQL integration problems in the database tier

–  Write PL/SQL procedures and functions as a wrapper around existing functions

–  For example: the following database types are not supported in JDBC and require a work around • Record Types • %rowtype and table of %rowtype

64 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Conclusion III/III

•  ADF is not a container for PL/SQL! –  Java is the primary language of ADF –  Use PL/SQL only when and where needed

•  Always work through the binding layer when accessing PL/SQL procedured and function from a managed bean –  Exceptions are handled by the ADF binding error handler –  Consistent programming model

65 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Further Reading

•  Oracle Forms developers should see: –  When and how to migrate Oracle Forms applications

•  http://www.youtube.com/watch?v=C4Dz8zO623U

–  ODTUG article about the myths in migrating Oracle Forms •  http://www.oracle.com/technetwork/developer-tools/forms/documentation/formsmigration-133693.pdf

–  ADF Summit: Oracle Forms to Oracle ADF redevelopment study •  http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/SummitADF/

SummitADF_Redevelopment.pdf

66 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Further Reading

•  http://www.oracle.com/technetwork/developer-tools/jdev/documentation/index.html –  Oracle JDeveloper and ADF Documentation Library –  Fusion Developer Guide

• How to Implement the Stored Procedure Calls for DML Operations

•  Avrom Faderman blog entry about maximum reuse of entities and view objects –  http://www.avromroyfaderman.com/2008/07/the-power-of-properties/

67 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

top related