You are on page 1of 28

My experience with Oracle ADF

search
APR
18
Oracle ADF Interview Question and Answers.
Q: Lifecycle of a Web Page Request Using Oracle ADF and JSF
Ans : Below figure shows a sequence diagram of the lifecycle of a web page
request using JSF and Oracle ADF in tandem.
Lifecycle of a Web Page Request Using JSF and Oracle ADF
Life Cycle of ADF
As shown in the figure, the basic flow of processing happens as follows:
A web request for http://yourserver/yourapp/faces/some.jsp arrives from the
client to the application server
The ADFBindingFilter finds the ADF binding context in the HTTP session, and if not
yet present, initializes it for the first time.
During binding context initialization, the ADFBindingFilter:
Consults the servlet context initialization parameter named CpxFileName and
appends the *.cpxfile extension to its value to determine the name of the binding
context metadata file. By default the parameter value will be DataBindings, so
it will look for a file named DataBindings.cpx.
Reads the binding context metadata file to discover the data control definitions,
the page definition file names used to instantiate binding containers at runtime,
and the page map that relates a JSP page to its page definition file.
Constructs an instance of each Data Control, and a reference to each
BindingContainer. The contents of each binding container are loaded lazily the
first time they are used by a page.
The ADFBindingFilter invokes the beginRequest() method on each data control
participating in the request. This gives every data control a notification at the
start of every request where they can perform any necessary setup.
An application module data control uses the beginRequest notification to acquire
an instance of the application module from the application module pool.

The JSF Lifecycle class, which is responsible for orchestrating the standard
processing phases of each request, notifies the ADFPhaseListener class during
each phase of the lifecycle so that it can perform custom processing to
coordinate the JSF lifecycle with the Oracle ADF Model data binding layer.
Note:
The FacesServlet (in javax.faces.webapp) is configured in the web.xmlfile of a JSF
application and is responsible for initially creating the JSFLifecycle class (in
javax.faces.lifecycle) to handle each request. However, since it is the Lifecycle
class that does all the interesting work, the FacesServlet is not shown in the
diagram.
The ADFPhaseListener creates an ADF PageLifecycle object to handle each
request and delegates appropriate before/after phase methods to corresponding
methods in the ADFPageLifecycle class as shown in If the appropriate binding
container for the page has never been used before during the users session, it is
created.
How JSF Page Lifecycle and ADF Page Lifecycle Phases Relate
The JSF Lifecycle forwards control to the page to be rendered.
The UI components on the page access value bindings and iterator bindings in
the pages binding container and render the formatted output to appear in the
browser.
The ADFBindingFilter invokes the end Request() method on each data control
participating in the request. This gives every data control a notification at the end
of every request where they can perform any necessary resource cleanup.
An application module data control uses the endRequest notification to release
the instance of the application module back to the application module pool.
The user sees the resulting page in the browser.

Initialize Context: In this phase the adf page initializes the LifecycleContext with
information that will be used during the Lifecycle.
Prepare Model: In this phase ui model is prepared and initialized. In this phase
page parameters are set and methods in the executable section of the page
definition of the ADF page are executed.
Apply Input Values: This phase handles the request parameters. The values from
the HTML are sent to the server and applied to the page binding in page
definitions.

Validate Input Values: This phase validates the values that were built in the
Apply input values phase
Update Model: Validated values supplied from user are sent to ADF business
components data model
Validate Model Updates: In this phase the business components will validate user
supplied values.
Invoke Application: This phase will process the ui events stack built during the life
cycle of page and also fire navigational events
Prepare Render: This is the final phase where HTML code is generated from the
view tree.
Q : What is Action Listener ?
Ans : An action listener is a class that wants to be notified when a command
component fires an action event. An action listener contains an action
listener method that processes the action event object passed to it by
the command component
Q:What are ADF BC(Business Components) ?Describe them.
Ans: All of these features can be summarized by saying that using ADF
Business Components for your J2EE business service layer makes your life a
lot easier. The key ADF Business Components components that cooperate
to provide the business service implementation are:
Entity Object: An entity object represents a row in a database table and
simplifies modifying its data by handling all DML operations for you. It can
encapsulate business logic for the row to ensure your business rules are
consistently enforced. You associate an entity object with others to reflect
relationships in the underlying database schema to create a layer of business
domain objects to reuse in multiple applications.
Application Module: An application module is the transactional component that
UI clients use to work with application data. It defines an updatable data model
and top-level procedures and functions (called service methods) related to a
logical unit of work related to an end-user task.
View Object: A view object represents a SQL query and simplifies working with
its results. You use the full power of the familiar SQL language to join, project,
filter, sort, and aggregate data into exactly the shape required by the end-user
task at hand. This includes the ability to link a view object with others to create
master/detail hierarchies of any complexity. When end users modify data in the

user interface, your view objects collaborate with entity objects to consistently
validate and save the changes
What is view object & view link in Oracle ADF?
ADF View Object: ADF view object definitions are business components that
collect data from the data source, shape that data for use by clients, and allow
clients to change that data in the Oracle ADF Business Components cache. For
example, a view object definition can gather all the information needed to:
Populate a single table element in a form
Create and process an insert or edit form
Create an LOV for populating a dropdown list
View object definitions must have a mechanism for retrieving data from the data
source. Usually, the data source is a database, and the mechanism is a SQL
query. Oracle ADF Business Components can automatically use JDBC to pass this
query to the database and receive the result.
When view object definitions use a SQL query, query columns map to view
attributes in the view object definition. The definitions of these attributes reflect
the properties of these columns, such as the columns' data types and precision
and scale specifications. When view object definitions use other data sources,
view object attributes map to "columns" of data from those data sources, as
defined by the programmer.
A view object definition is a template for view object instances, which represent
particular caches of rows of data. Different users will always use different view
object instances, but the same user may also use multiple view object instances
if they need separately maintained caches from the same query.
A view object definition can have up to four parts:
An XML file, which represents the portion of the view object definition that can be
developed declaratively. This information consists of the mechanism (usually a
SQL query) that the view object uses to retrieve data from the data source, and
the way in which the columns of the SQL query map to entity attributes (which
handle actual O/R mapping). For many view object definitions, the XML file by
itself is sufficient.
A view object class, which represents an individual view object instance. View
object classes allow you to write custom methods that affect multiple rows in a
query. View object classes extend the classoracle.jbo.server.ViewObjectImpl. If
you do not need to write custom view object methods, you need not generate an
entity object classADF can use oracle.jbo.server.ViewObjectImpl directly to
represent instances of the query result set.

A view row class, which represents individual rows of the query result. View row
classes allow you to write custom methods that affect a single row of data, and
they provide typesafe accessors to retrieve and change data. View row classes
extend the class oracle.jbo.server.ViewRowImpl. If you do not need custom rowlevel methods or typesafe accessors, you need not generate a view row class
ADF can useViewRowImpl directly to represent view rows.
A view definition class, which represents the query itself. View definition classes
act as Java wrappers for the XML file, so if you need special handling of the
metadata (for example, if you need to change it dynamically), you can add this
code in the view definition class. View definition classes extend the
classoracle.jbo.server.ViewDefImpl. If you do not need custom handling of your
metadata, you need not generate a view definition classADF can use
ViewDefImpl directly to wrap the metadata.
1 Attribute Mappings
Like entity attributes, the values of view attributes can be read or changed using
the methods getAttribute() andsetAttribute() in the ViewRowImpl class or by
using generated getters and setters in a custom view row class.
There are two different types of view attributes, however, for which these
accesssor methods function quite differently:
SQL-only view attributes are not mapped to entity attributes. For these attributes,
the accessor methods read values from and make changes to data in the view
object instance's cache of view rows.
Entity-derived view attributes are mapped to attributes in an entity object
definition. For these attributes, the accessor methods will call getAttribute() and
setAttribute() on the relevant entity object instance. The data will be changed
within the entity collection's cache of entity object instances, not within the view
object instance's cache of view rows.
Because entity object definitions handle DML operations, attributes that will be
used to make changes to the database must be entity-derived. However, if a view
object definition will be used for data retrieval only, there is an advantage to
making all its attributes SQL-only: such view object definitions, called SQL-only
view object definitions, bypass the entity collection's cache entirely, avoiding the
overhead and resources required to create entity object instances.
2 Navigating Through Result Sets
View object instances are row iterators. In particular, they are row iterators of
view rows.
Like other row iterators, view object instances contain a current row pointer that
points to one particular view row. This pointer can be moved around and used to
extract rows from the iterator.

Row iterators contain a number of methods to help you navigate and extract
individual rows from them:
next() advances the current row pointer in the row iterator and returns that row.
hasNext() checks to make sure that the row iterator has more rows after the
current row pointer. You can use next() and hasNext() together to create a loop to
cycle through the rows in the iterator.
First() moves the current row pointer to the first row in the iterator and returns
that row.
Last() moves the current row pointer to the last row in the iterator and returns
that row.
Previous() steps the current row pointer back one row and returns that row.
hasPrevious() checks to make sure that the row iterator has more rows after the
current row pointer. You can use previous() and hasPrevious() together to create a
loop to cycle backwards through the rows in the iterator.
3 Creating and Deleting Rows
ViewObjectImpl also contains methods to create rows:
createRow() creates a view row appropriate to the view object definition.
insertRow() inserts the row into the view cache.
You can mark a row for deletion by calling Row.remove() or
ViewObjectImpl.removeCurrentRow().
4 Keys
A key is a set of attributes that allow you to quickly retrieve one or more rows
from a view object instance's query result. Persistent view object attributes based
on primary keys are automatically part of the view object's key; you can make
other attributes part of the view object's key as well.
You can use an array containing a partial or complete list of attribute values to
set up an object of typeoracle.jbo.Key. You can then pass this object into the
method ViewObjectImpl.findByKey() to return an array of rows that match the key
values.
5 View Criteria
View criteria are structured criteria that you can use to create searches.
View criteria are collections of view criteria rows. A view criteria row specifies
query-by-example requirements for one or more view object attributes. A view
row matches if it meets all of the requirements.

When you apply view criteria to a view object instance, the query is restricted to
return those view rows that match at least one of the view criteria rows.
Effectively, therefore, view criteria assemble a WHERE clause in conjunctive
normal form: the WHERE clause is a disjunction of conjunctions of query-byexample requirements.
View criteria are implemented by the class oracle.jbo.ViewCriteria; view criteria
rows, by the classoracle.jbo.ViewCriteriaRow.
ADF View Link: Oracle ADF view links are business components that define a
relationship between two Oracle ADF view object definitions (the "source" and
"destination" view objects) based on sets of view attributes (the "source" and
"destination" attributes) from each. These can range from simple one-to-many
relationships to complex many-to-many relationships. This allows you to easily
create master/detail relationships between data controls in the client. For
example, creating a view link between view objects will allow you to create
relationships between:
A dropdown list for selecting a customer and a table displaying that customer's
orders
The nodes in a tree control and their respective children
An HTML page containing two frames: one that allows the user to browse for
items and the other that lists the warehouse in which the selected item is stored
Because view objects are data model components, you should consider your
client's data needs when defining them. Decide which controls will need to be
related, and which view objects will manage them.
View Link Definitions and View Link Instances
Often, it is important to distinguish between the following:
View link definitions, which consist of an XML file that defines the view link
View link instances, which are particular references to a Oracle ADF view link
definition within a Oracle ADF application module definition.
View Accessors:
Use to define the list of available view accessors on the current entity object or
view object.
View accessors are value-accessor objects in ADF Business Components. You
create a view accessor to point from a base entity object attribute or view object
attribute to a source view row set.

The view accessor returns a list of all possible values to the attribute of the base
object.
1 Accessor Attributes
When you create a view link definition between two view object definitions, you
can select to add accessor attributes to the source view object definition, the
destination view object definition, or both. These accessor attributes function
much like the accessor attributes to associations:
Their names can be passed as arguments to ViewObjectImpl.getAttribute().
If you generate a view row class, a getter method for the accessor attributes will
be included in the class.
The accessor method will return a view row or a row iterator, depending on the
cardinality of the view link definition.
An accessor attribute returns a row or row iterator that is static, not one that
maintains a synchronized master-detail relationship. For example, suppose
DepartmentEmployees is an accessor attribute that returns rows of
EmployeesView from rows of DepartmentView. Suppose you execute the following
code on the current row of DepartmentView:
RowIterator details = current.getAttribute("DepartmentEmployees");
Then suppose the current row of DepartmentView changes. The row iterator in
details will not change: it will still contain details of the original row.
To maintain a synchronized master-detail relationship, you should use view link
instances in an application module instance.
2 Cardinality:
Like associations, view link definitions can be one-to-one, one-to-many, or manyto-many. One-to-one and one-to-many view link definitions can either be based
on associations or they can use attribute matching the way associations do.
Many-to-many view link definitions must be based on many-to-many
associations.
Q: ADF 10g navigation rules example in faces-config.xml file.
Ans: Navigation rules tells JSF implementation which page to send back to the
browser after a form has been submitted. We can declare the page navigation as
follows:

<naviagation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</naviagation-rule>
This declaration states that the login action navigates to /welcome.jsp, if it
occurred inside /index.jsp.
Q: Setting the range of table
A: <af:table rows=#{bindings.LoggedInUserServiceRequests.rangeSize}/>
Q : Which component in ADF BC manages transaction ?
A : Application Module, manages transaction.
Q : Where is that we write business rules/validations in ADF and why?
A : We should ideally be writing validations at Entity Object level, because they
provide highest degree of reuse.
Q : What are various components in ADF?
A : Oracle ADF has following components
ADF Business Components: VO, EO & AM
ADF Model : DataBinding (.cpx, .xml) & DataControls(.dcx)
ADF View: JSP, JSF, ADF Faces etc.
ADF Controller: Task flows (adf-config.xml), faces-config.xml
Q : What is the return type of Service Methods?
A : Service Methods can return Scalar or Primitive Data types.
Q : Can Service Methods return type Void?
A : Yes, Service Methods can Return type Void
Q : Can Service Methods return Complex Data types?

A : No, service methods can return only primitive/scalar data types.


Q : Where do we write business rules or validations in ADF and why?
A : We should be writing validations at Entity Object level, because they provide
highest degree of reuse.
Q : What are the various access scopes supported by ADF?
A : ADF Faces supports the following scopes
backingBean
request
view
pageFlow
session
application
Memory Scope for ADF Managed Beans
Scope Description
application
The application scope lasts until the application stops. Values that you store in a
managed bean with this scope are available to every session and every request
that uses the application.
Avoid using this scope in a task flow because it persists beyond the life span of
the task flow.
session
The session scope begins when a user first accesses a page in the application
and ends when the user's session times out due to inactivity, or when the
application invalidates the session.
Use this scope only for information that is relevant to the whole session, such as
user or context information. Avoid using it to pass values from one task flow to
another. Instead, use parameters to pass values between task flows. Using
parameters gives your task flow a clear contract with other task flows that call it
or are called by it. Another reason to avoid use of session scope is because it may
persist beyond the life span of the task flow.

pageFlow
Choose this scope if you want the managed bean to be accessible across the
activities within a task flow. A managed bean that has a pageFlow scope shares
state with pages from the task flow that access it. A managed bean that has a
pageFlow scope exists for the life span of the task flow.If another task flow's page
references the managed bean, the managed bean creates a separate instance of
this object and adds it to the pageFlow scope of its task flow.
view
Use this scope for managed bean objects that are needed only within the current
view activity and not across view activities. It defines scope for each view port
that ADF Controller manages, for example, a root browser window or an ADF
region.
The life span of this scope begins and ends when the current viewId of a view
port changes. If you specify view, the application retains managed bean objects
used on a page as long as the user continues to interact with the page. These
objects are automatically released when the user leaves the page.
request
Use request scope when the managed bean does not need to persist longer than
the current request.
backingBean
A backing bean is a convention to describe a managed bean that stores
accessors for UI components and event handling code on a JSF page. It exists for
the duration of a request and should not be used to maintain state.
Use this scope if it is possible that your task flow appears in two ADF regions on
the same JSF page and you want to isolate each instance of ADF region.

Q : How to Skip Validation in ADF using SkipValidation?


A : This method mainly used for Model layer validation skip.
ADF has a very robust validation framework. Validations can be added at different
layers (view, model and business services) based on your application's
requirement. To learn more about the ADF validation framework, please go
through the Fusion Developer's Guide for Oracle Application Development
Framework.
That said, however, in a real business scenario there are cases where the
validation needs to be skipped (or by passed) conditionally while submitting the
form. This post discusses this topic with some common use cases.

Keep immediate=true
A very common way to skip validation is by keeping the value for immediate
attribute as 'true' for the UIComponents. Immediate attribute allow processing of
components to move up to the Apply Request Values phase of the lifecycle.

scenario:
While canceling a specific action, system should not perform the validation. One
possible way to achieve this is by keeping immediate=true associated with UI
element. To know more abut this feature, please refer this wiki.
Sometimes you may need to update UI controls with model data as part of the
immediate action. Make sure that you call resetValue() on the UIInput in this
scenario. This causes to reset the submitted value and would ensure that UI gets
updated with right value from the model.

SkipValidation
Another approach is to use SkipValidation property associated with the page
definition file.SkipValidation by pass the model layer validation based on the
specified parameter value.
Please note that:
1. This doesnt have any impact on JSF/ADF Lifecycle.
2. This property doesnt have any effect on the client side validation (even if it is
generated using the EL bound with model layer)

Where can I locate SkipValidation?


SkipValidation can be located as part of the root node of the page definition file.

Possible values for SkipValidation are given below.

a. SkipValidation=true
Setting SkipValidation property to true will bypass the ADF Model validation. In
this case validation happens only when you commit the transaction( i.e: when
you call transaction.commit()). Please note that SkipValidation skips only the
entity level validation. The attribute level validation fire irrespective of the value
for the boolean flag

Scenario:
This is useful where you need to delay the validation till the point where
transaction gets committed to Database. There are cases where business data
needs to be captured in bulk. A typical example would be capturing transaction
data using a grid form/tabular list. Business user must be able to key in values in
any order. i.e. even without completing the data capture for the current record,
user must be able to move to next set of records. Here model level validation
needs to be delayed till we really save the data. SkipValidation=true is the right
option to achieve this sort of use case, which does the validation across records,
only while committing the transaction.

b. SkipValidation=custom
In this case, framework validates only the 'CustomValidator' specified in page
definition file.
The value of the 'CustomValidator' property would be an EL expression that

evaluates to a bean that implements the


"oracle.binding.BindingContainerValidator interface"

Scenario:
This gives more control to the developer while validating the data. Only
validates(or rather executes) what is given in custom implementation for
BindingContainerValidator. It is much useful in complex business scenarios where
developer needs finer control on validation.

c. SkipValidation=skipDataControls
skipDataControls means that it will skip the data control level validation (also
known as Transaction Level validation) and instead only will validate data in the
row or rows which got updated through iterator in the current binding container.

Scenario:
The property is very much useful while dealing with below given scenarios.
1. A single entity is mapped to multiple tabs in a page.
2. Same page is making use of multiple Data Controls. Here commit on one Data
Control should not trigger validation on other Data Controls defined in the same
page.

d. SkipValidation=false
This is the default value for SkipValidation, apparently this setting just ensures
the normal flow for validation during form submission.

Q.What are Entity Objects?


A: Entity objects are Data Access Objects (DAOs) that are responsible for
persisting & caching data, validation, and encapsulating business rules.
Represent a database table or other data source.
Handles database caching.
Contains attributes representing the database columns.
Encapsulates attribute-level and entity level validation logic.
Can contain custom business methods.
Q : Can an entity object be based on two Database Objects(tables/views) or two
Webservices?
A : No, Directly its not possible to create EO using multiple tables.
Entity objects will always have one to one relationship with a database object
or web service.
But using views you can create Entity Objects on multiple tables.
Q.What is Control Hints in Entity Object configuration?
A: Control hints are associated with the current view or entity attribute. All view
objects inherit the hint values at run time.
Control hints for data controls and bindings, including: Labels, Date & currency
formatting.
Q.What are View Objects?
A: View objects, which can be bases on entity objects/Web Services, represent
the data which you want to view and manipulate.
Present a view or slice of business data.
Are used for joining, filtering, projecting, and sorting your business data.
Can be based on any number of entity objects.
Can also be constructed from a SQL statement.
Read-only SQL Based View Objects:
Is not based on any entity based object.

Cannot be used for insert, update, or delete.


. Use SQL-based view objects for query only views, which do not need the
functionality of entity objects.
Q.What is Application Module?
A: An ADF components application module is a service object that coordinates
view objects for a specific task in the same way that a form usually encapsulates
a single user task. It contains only the business services that the application
requires, and can be compared to a Forms module.
An application module can represent and assist with tasks such as:
Updating customer information
Creating new order
Processing salary increases.
Q.What is view link? How to create it? What is idea behind it?
A: View Link is an active link between view objects.You can create view links by
providing the Source & destination VO attributes.
Oracle ADF view links are business components that define a relationship
between two Oracle ADF view object definitions (the "source" and "destination"
view objects) based on sets of view attributes (the "source" and "destination"
attributes) from each.
These can range from simple one-to-many relationships to complex many-tomany relationships. This allows you to easily create master/detail relationships
between data controls in the client. For example, creating a view link between
view objects will allow you to create relationships between:
A dropdown list for selecting a customer and a table displaying that customer's
orders
The nodes in a tree control and their respective children
An HTML page containing two frames: one that allows the user to browse for
items and the other that lists the wherehouses in which the selected item is
stored
View Links can be created using:
1.

Two View objects

2.

Based on EO Association

View Links and Queries


A view link definition relates two view object definitions. In the vast majority of
cases, the view object definitions will contain SQL queries that access a
database, and the view link definition will relate those queries using a
parametrized WHERE clause, which is appended to the destination view object's
query and resolved using the values of source attributes.
For example, suppose you had the following view object definitions:
CustomersView, containing the query:
SELECT * FROM CUSTOMERS
OrdersView, containing the query:
SELECT * FROM ORDERS
You could create a view link, CustOrdLink, with

CustomersView's CustomerId attribute as its source attribute

The parametrized WHERE clause

WHERE :1 = ORDERS.CUSTOMER_ID
You could then use CustOrdLink conjunction with a row from CustomersView (for
example, the row for Customer 101) and all of OrdersView to return the rows from
the query
SELECT * FROM ORDERS WHERE 101 = ORDERS.CUSTOMER_ID

JDeveloper will create the parametrized query for you based on the attributes you
select. If you do not change this query, you can make the view link bidirectional.
This will switch the roles of the source and destination attributes. For example, if
you make CustOrdLink bidirectional, you can use it in conjunction with a row from
OrdersView (for example, a row for an order placed by Customer 101) and all of
CustomersView to return the rows from the query
SELECT * FROM CUSTOMERS WHERE CUSTOMERS.CUSTOMER_ID = 101
Q. Can you make View Link bidirectional?
A: Yes, you can make a view link bidirectional.

Its handled by view link query.


View Links created on Association are also bidirectional.
Q. How to create read only VO?
A: While creating View select below marked option
A view is read-only if it does not have Primary Keys or if all its entity
references are reference-only.

Q. Is EO to EO association possible like VO? If yes how?


Direct EO-EO association is possible.
In Jdeveloper select option New Association, Give name to association, select
attributes in source & destination Eos.
1.

One-to-many relationships based on foreign keys.

2. A single many-to-many association corresponds to two foreign key


relationships:
A one-to-many relationship between the source table and a third table, the
intersection table
A one-to-many relationship between the destination table and the intersection
table.

Q. What is Control hint?


A: Control hints are additional attribute settings that the view layer can use to
automatically display the queried information to the user in a consistent, localesensitive way.
JDeveloper manages storing the hints in a way that is easy to localize for multilingual applications.
Used to set: Parameters in screenshot

Ex. Number, Number format, Date Format etc.


Q: What are UI Hints & List UI Hints?
A:
UI Hints: VO -> Query -> Create or Edit view criteria -> click Tab UI Hints
Use to specify the default properties for a query search components runtime
usage of individual named view criteria. Named view criteria that you create for
view object collections can be used by the web page designer to create query-byexample search forms.

List UI Hints: Open view-object -> List UI Hints


Use to specify default LOV (list of values) hints when you want the LOV-enabled
attributes of other view objects to inherit the list UI hints from the current view
object. Use to specify the type of LOV (list of values) component and one or more
attributes to display in the LOV for the attributes that you will LOV-enabled.
Additionally, you can set properties of the LOV component to customize it
behavior in the user interface.

Q: What are the security application layers & how they handled in Oracle ADF?Q:
What is policy store and identity store in OID?
A: Identity Store is used to store information about users and groups while the
Policy Store is used to store information about security policies.

Q: What is the difference between databindings.cpx and datacontrol.dcx?


A: The DataBindings.cpx file contains the Oracle ADF binding context for your
entire application and provides the metadata from which the Oracle ADF binding
objects are created at runtime.
The DataControls.dcx file is created when you register data controls on the
business services. This file is not generated for Oracle ADF Business Components.
It identifies the Oracle ADF model layer data control classes(factory classes) that
facilitate the interaction between the client and the available business service.

Q: What is binding context and binding container?


A: Binding context is a runtime map between the data controls and page
definition of pages in the application which is used to access the binding layer. It
is accessible through the EL expression in your jspx pages.
Binding container is a request-scoped map that is used to instantiate the page
bindings. This is accessible through the EL expressions. Also, since it is requestscoped map, it is accessible during every page request.
Q: What are the different types of bindings in ADF?
A: ADF contains the following types of bindings:
Method Bindings: This binding is used when you want to use custom methods to
be executed.
Attribute Bindings: This is the binding to retrieve the value of a single view
attribute in the iterator bindings current view row. For eg;
#{bindings.CustomerId.InputValue}
Tree Bindings: This is used for tables, tree-tables and trees. It is used to expose
rows of a table in the iterator bindings current range. Eg; All Customers#{bindings.AllCustomers.labels.CustomerId}
Action Bindings: This binding type is used when buttons or command links are
dropped on the user interface and require an action to be performed on them. We
can use data control operations on them, for eg, Create, Delete, First, Last,
Commit, Rollback etc.
Iterator Binding: This binding is created by the application to access the ADF
binding context. It contains a reference to the page bound data collection, helps
access it and iterates over its data objects.
Q : What is the return type of Service Methods?
A : Service Methods can return Scalar or Primitive Data types.
Q : Can Service Methods return type Void?
A : Yes, Service Methods can Return type Void

Q : Can Service Methods return Complex Data types?


A : No, service methods can return only primitive/scalar data types.
Q : Which component in ADF BC manages transaction ?
A : Application Module, manages transaction.
Q : Can an entity object be based on two Database Objects(tables/views) or two
Webservices ?
A : No entity objects will always have one to one relationship with a database
object or web service.
Q : Where is that we write business rules/validations in ADF and why?
A : We should be writing validations at Entity Object level, because they provide
highest degree of reuse.
Q : What are the various access scopes supported by ADF?
A : ADF Faces supports the following scopes
Application Scope
Session Scope
PageFlow Scope
Request Scope
BackingBean Scope.
Q : What is the purpose of adfc-config.xml?
A: The adfc-config.xml file is the configuration file for an ADF unbounded task
flow. This file contains metadata about the activities and control flows contained
in the unbounded task flow.
Q : What is the purpose of faces-config.xml?
A: Use the faces-config.xml file to register a Framework applications resources,
such as custom validators and managed beans, and to define all page-to-page
navigation rules.

Q : In which xml do you configure the skin for your framework application?
A: trinidad-config.xml
Q : How do you decide whether the application should be deployed as an EAR or
a WAR?
A: If the application contains run-time customizations using MDS, it must be
bundles as an EAR. For simple webcenter portal application with no such
customizations, WAR can be created.
Q : What is the purpose of jazn-data.xml?
A: This file is used for defining the permissions and privileges for various groups
of users on various taskflows created in the application.
Q : When we drag drop VO from DataControl which binding occurs?
A: Value binding occurs.
Q : Explain Data binding & its types, sub-types?
A : Oracle Application Development Framework (Oracle ADF) provides several
types of binding objects to support the attributes and operations exposed by the
Oracle ADF data controls for a particular business object:
Iterator binding, one per accessor attribute that your page or panel displays.
Iterates over the business objects of the data collection and maintains the row
currency and state.
Value bindings, one for each data-bound UI component. Provides access to data.
Action binding, specifically defined for a button component. Provides access to
operations defined by the business object.
Value Binding Types:
1. Attribute Value Binding
2. Boolean Value Binding
3. List Value Binding
4. Range Value Binding
5. Scroll Value Binding

Q: Explain Data Control Palette hierarchy


A: Data Control Palette hierarchy:The Data Control Palette displays two types of
actions:
Actions that typically operate on all data collections in the current web page's
binding context (such as Commit and Rollback) in the Operations folder at the
root level of the hierarchy.
Operations on a specific data collection (for example, MyView1). Data collectionspecific operations (such as Create and Delete) appear in the Operations folder
as child nodes of the collection in the Data Control Palette.
Q: Write code to access the current row and or the view object inside your bean.
A: code to access the current row and or the view object inside your bean:

BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
DCBindingContainer dcbc = (DCBindingContainer) bc;
DCIteratorBinding lBinding = dcbc.findIteratorBinding("EmployeesViewIterator");
EmployeesViewRow row = (EmployeesViewRow) lBinding.getCurrentRow();
EmployeesView view = (EmployeesView) lBinding.getViewObject();
You have to change the iterator name 'EmployeesViewIterator' to the name of
your VO iterator (look it up in the page bindings) and the classes Employees.
Q: How many types of VOs we can create in Oracle ADF?
A: There are four types of VOs we can create as shown in below image, select
radio button & create VO.

1. Updatable VO (Updatable access through entity objects) - Here EO need to be


created for updatable VOs.
2. Read only VO (Read-only access through SQl query) - No need to create EO,
VOs can be created using SQL queries, table, or views.

3. Rows populated pro-grammatically, not based on query - This is also read-only


view. Here add one or more attributes to use in program. In the Attribute Settings
page, adjust any setting you may need to for the attributes you defined.
4. Static VO (Rows populated at design time- Static List): You use the Create View
Object wizard to create static view objects. The wizard lets you define the desired
attributes (columns) and enter as many rows of data as necessary. The wizard
displays the static data table as you create it.
You can also use the Create View Object wizard to create the attributes based on
data from a comma-separated value (CSV) file format like a spreadsheet file. The
wizard will attempt to create the attributes that you define in the wizard with
data from the first row of the flat file.
Check below image- circled import option is to import comma separated .cvs file
or other file.

Q: Can we change DB connection for any particular AM?


A: YES, follow steps to change DB connection:
1. Double click on AM.
2. GO to the configuration tab, click on configuration file bc4j.xml
3. Here we have attribute JDBCName under element AppModuleConfig, change
the connection which is created for other DB.
Q: What is view criteria, how can you change view criteria at runtime?
A: View Criteria: View criteria are structured criteria that you can use to create
searches.
View criteria are collections of view criteria rows. A view criteria row specifies
query-by-example requirements for one or more view object attributes. A view
row matches if it meets all of the requirements.
When you apply view criteria to a view object instance, the query is restricted to
return those view rows that match at least one of the view criteria rows.
Effectively, therefore, view criteria assemble a WHERE clause in conjunctive
normal form: the WHERE clause is a disjunction of conjunctions of query-byexample requirements.
View criteria are implemented by the class - oracle.jbo.ViewCriteria;

view criteria rows, by the classoracle.jbo.ViewCriteriaRow.


View criteria is like querying a SQL query.

Sometimes you need dynamic ViewCriteria that you can handle at runtime ,
here is the solution ,you can create and apply ViewCriteria ProgrammaticallySample UseCaseSuppose you have Department VO
You want to filter this VO for DepartmentId 10
Do this using this code snippet
/**Get ViewObject*/
ViewObject vo = getAm().getDepartments1();
/**Create ViewCriteria on ViewObject*/
ViewCriteria vc = vo.createViewCriteria();
/**Create ViewCriteriaRow for that Criteria*/
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
/**Set the values for ViewCriteriaRow*/
vcRow.setAttribute("DepartmentId", 10);
/**Add row to ViewCriteria*/
vc.addRow(vcRow);
/**Apply Criteria on ViewObject*/
vo.applyViewCriteria(vc);
/**Execute ViewObject*/
vo.executeQuery();

public pcAMImpl getAm() {

pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
return am;
}
Q: How can you manage transaction in ADF?
A: We can manage transaction using Application Module, different Application
Modules, Bounded Task Flows & at ADF Data Control Level.

Q: What is Bundled Exception Mode in ADF?


A: An application module provides a feature called bundled exception mode
which allows web applications to easily present a maximal set of failed validation
exceptions to the end user, instead of presenting only the first error that gets
raised. By default, the ADF Business Components application module pool
enables bundled exception mode for web applications.
You typically will not need to change this default setting. However it is important
to understand that it is enabled by default since it effects how validation
exceptions are thrown. Since the Java language and runtime only support
throwing a single exception object, the way that bundled validation exceptions
are implemented is by wrapping a set of exceptions as details of a new "parent"
exception that contains them. For example, if multiple attributes in a single entity
object fail attribute-level validation, then these multiple ValidationException
objects will be wrapped in a RowValException. This wrapping exception contains
the row key of the row that has failed validation. At transaction commit time, if
multiple rows do not successfully pass the validation performed during commit,
then all of the RowValException objects will get wrapped in an enclosing
TxnValException object.
When writing custom error processing code, you can use the getDetails() method
of the JboException base exception class to recursively process the bundled
exceptions contained inside it.
Note: All the exception classes mentioned here are in the oracle.jbo package.
Posted 18th April 2013 by Dattatraya Tembare
Labels: Oracle ADF

7 View comments

Swaroop KumarMarch 11, 2014 at 9:00 PM


Good work. It is really very helpful beginners.
Reply
hari krishnaApril 24, 2014 at 10:45 AM
Real good stuff...
Reply
Amrita BahadurMay 14, 2014 at 10:01 AM
Quite helpful collection of ADF Fundamental information.
Reply
AnonymousSeptember 14, 2014 at 12:25 AM
nice ..u have done very hard work mate !!
Reply
AnonymousNovember 10, 2014 at 7:26 AM
Good job !! many concepts are clarified !!
Reply
Oracle ADF Online TrainingMay 12, 2015 at 11:47 PM
This comment has been removed by the author.
Reply
S M ConsultantsJune 22, 2015 at 6:00 AM
Nice work.....i like it very much..
S&M consultants

Reply
Loading