-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
|Receive Email for New Articles|
|OA Framework Table based Screen||| Print ||
|Written by Anil Passi|
|Sunday, 25 February 2007|
In this article, we will implement simplest possible OA Framework page that interacts wih the database via a screen. The article will be kept to bare minimal functionality, so that you understand the basic principles of OA Framework and its database interaction functionality.
What will be shown in this article?
1. How to build a default screen based on a table [just like a base table in our good old D2K]
2. How to make OA Framework do inserts and updates to that table.
There will be no LOV, no validations, no search facility whatsoever for this article. Just the database DML from screen.
Is this the only way to build OA Framework screens that interact with database?
Well, there are two methodologies Oracle provides to perform DMLs on tables.
1. Java Based Entity Objects
2. PL/SQL Based Entity Objects
Note: In this article I will be covering Java Based Entity Objects.
What are the steps?
Broadly speaking, I will classify these steps into two. a) Non-Programming Steps and b) Programming Steps.
First lets revisit some basics briefly before we discuss the steps.
Nothing but a grouping of objects that are developed to achieve a business functionality.
Entity Objects - EO
A java class that manages DML and validations on the base table
View Object - VO
A set of Java/XML files that represent a query on a table or sets of tables. A default VO that is based on EO will do select * from table[of EO]
Application Module - AM
Manages the Database transaction state. Hence all the DB Related operations from Web Page must be routed via AM.
Note:- VO's are attached to AM. This means that AM interacts with EO via VO.
A web page using which user interacts with system.
OA Page Regions
Different sections with in the OA Page, to logically group similar items.
Region can be attached to the AM, hence as soon as the Page Region gets loaded, the AM attached to that page will be instantiated by OA Framework. Given that VO's are attached to AM, VO's attached to the AM will also be instantiated by OA Framework when AM gets instantiated.
A java class that gets called when the "OA Page" is loaded onto the screen to display.
This java class is also called then user fires an action on the page, for example Clicking on a button.
If you wish to visualise the steps, prior to reading them, then have a look at the picture below.
In the picture below, the steps in red are the execution steps, whereas the steps in black are design time steps.
Non-Programming Steps -- [Will be detailed with screenshots latter in the article]
1. Create a simple table with 3 columns i.e. Person_id, First_name and Last_name.
2. Create a new BC4J package and a new OA Project. All the remainder objects/components will be created within this BC4J
3. Create an entity object based on the table created in step 1.
4. Create a view object based on the entity object of step 3 [We will generate Default VO for the EO]
Note: In case you create a Default VO from EO, then you need to edit Property of VO to generate RowImplementation Class too.
5. Create an Application Module
6. Attach the ViewObject of step4 to Application Module of step5.
7. Create a OA Page and a Region within that page.
8. Attach the AM of step5 to the property of the region created in step7. Also provide a window tile and title to that region (using property palette of that region)
9. Create a region/fields for the database table. The region will be based on view object of step4.
This can be done using region creation wizard, and this nested region can be created within the region of step7. OA Framework region wizard will create on field for each of the corresponding viewobject fields.
10. Create a Controller for the region created in step7
11. Add a submit button to the page.
You can run the page at this stage, and you will see a page similar to below.
When the page gets loaded, a method [procedure] named processRequest is called, in Controller java class.
When the button is pressed, a method [procedure] named processFormRequest is called, in Controller java class.
Our high level programming steps will be:-
1. Initialize the ViewObject for the record/fields in this page. Effectively this step is required so that a blank record is created in memory for our table. We want this blank record to be created as soon as the page loads.
Hence this initialization of the "VO Record" is made to happen from processRequest of Controller.
But we know that Controller must not be directly accessing VO, because we let AM to manage these operations.
Hence controller will invoke a method in AM, and AM will initialize the VO.
Note:- Any data you enter into the three fields above are being reflected into the corresponding VO Attributes[ VO Fields].
2. Once user enters data into the 3 fields and clicks the button, the VO Attributes in memory will get populated. Hence all we need to issue is a COMMIT.
Can we issue a commit in the Controller[processRequest] ?
Of course note. But surely we need to get the ball rolling from processRequest, as that method gets called when the button is clicked.
Hence this step comprises of following sequence of programming logic
a. From controller invoke a method within AM.
b. Inside that method of AM, do a COMMIT.
That's it for the steps. As soon as a Commit occurs, the AM will know [based on VO State] whether an Insert is to be done or update is to be done on ViewObject. Hence AM will call appropriate methods VORowImplementation class. The VO being mapped to EO, the methods in Entity Objects will be called to carry out DML. Given that AM and VO together track the state the record, OA Framework will hence know whether insert or update must be called.
Please click this link to see the details of non-programming steps
Please click this link to see the details of programming steps
written by Alpa , February 27, 2007
written by Ashok , April 21, 2007
Help needed to create Key Flexfields in OA Framework page
written by James , February 12, 2008