Friday 14 October 2011

Introduction to ADF

I explained ADF architecture in brief in earlier article Introduction to ADF. If you remember, service layer is at the bottom of the food chain. I also briefly talked about what is the technology ADF provides for this service layer - ADF Business Components or ADFbc.
Lets understand quickly what is ADFbc, what are its major components and terminologies that you will get used to when build your service layer.
Biggest advantage of using ADFbc as service layer is that you aren't required to write the application infrastructure code required by the typical Java EE application like Connect to the database, Retrieve data, Lock database records, Manage transactions, connection pooling, user and session management etc.
Another advantage is that ADFbc allows you to build your code in modular fashion so that you can re-use it for multiple purposes. It allows you to build good part of the code in declarative fashion using wizards in jdevelopoer. You can add and test business logic in ADFbc which automatically integrate with databases. Also, you don't need to write code to access and update the views from browser, desktop, mobile, and web service clients. It is write-once-use-anywhere code.
There are three core objects involved when we work with ADFbc.
  1. Entity object - An entity object  represents a row in a database table. You can compare it with an EJB in J2EE world. It simplifies modifying table row data by handling all data manipulation language (DML) operations for you. It can encapsulate business logic for the row and all DML goes via entity object so you can ensure that your business rules are consistently enforced. You associate an entity object with another entity object to reflect relationships in the underlying database schema. The relationship between two EOs is called Entity Association.
  2. View object - A view object represents a SQL query. You use the full power of the familiar SQL language to join, filter, sort, and aggregate data into exactly the shape required by the end-user task. When end users modify data in the user interface, your view objects delegate the work to entity objects to consistently validate and save the changes. You can create view level relationships between different view objects and it is called as View Link. View Links are useful when you have master-child hierarchies and you want to reflect that in the data visible to your client.
  3. Application module - An application module is the transactional component that 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. Application Modules include one or move View Objects, along with their associated View Links.
Each of these objects are created as XMl files. They have associated framework classes to them. You can also have your own class that override default behaviour. We will talk about these base classes and their usage in a different post.
 
As a best practice, it is good to follow naming conventions and package structure when create theset objects. The defaults can be configured in JDeveloper.
 
To set these preferences, follow these steps.
  1. Launch JDeveloper
  2. Go to Tools : Preferences : Business Components
  3. If you want that you need custom java classes for your objects, select appropriate check box.
  4. Select Application Modules and check "Customize Runtime Instantiation Behavior" to "lazy-loading". This is to improve performance.
  5. Select Base Classes. If you are going to write lot of ADFbc and would like to have lot of common over-ridden logic, you may want to define your own base classes that extend framework base classes. If you are doing that, you can specify them here so that you do not have to change that every time you generate new ADFbc object.
  6. Select Entities. Check Update Batching = 5. This is to improve performance. I will explain more about various performance aspects when talk about tuning.
  7. Select Object Naming and use above suffix.
  8. Select Packages and use above naming convention. Note that anything upto model comes from default project that you will specify when create a Model Project. So, we just need to specify anything that follows model.
  9. Select View Object and check "Enable declarative SQL mode for new objects". We will talk about this option in a different post.
 
 
 
 
 

2 comments:

  1. Thanks for sharing useful points about the oracle fusion middleware and good points were stated in the blog

    CALFRE

    ReplyDelete
  2. Hi,
    The blog is very informative.This is very interesting concept.
    oracle fusion SCM on line training

    ReplyDelete

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...