Showing posts with label Entity Object. Show all posts
Showing posts with label Entity Object. Show all posts

Thursday, December 23, 2010

ADF Model: Creating Date Effective EO

Date-effectivity is an excellent feature available in Jdeveloper 11g. To learn the basics of date-effectivity in ADF, please go through my post Learning basic of Date Effectivity in ADF. With Jdev 11g, we can create date-effective objects and do date-effective operations using simple API calls. Before going into all those details, the first requirement would be creating Date-Effective EO.

The first requirement to create a DE-EO based on a table, the table should have two date columns to represent Effective Start Date(ESD) and Effecitve End Date(EED) of the record and these columns should be marked as primary keys along with id column. In other words, we need to define a composite key based on the id column and ESD and EED columns.

Creating Date Effective EO is same as creating normal EO. In addition, we need to do the following steps to make it date-effective.
1. Mark the EO as Date Effective by specifying the attribute Effective Date Type = 'EffectiveDated'. You can find this property in 'General' tab property inspector.

This will generate a new transient attributte called 'SysEffectiveDate' in the EO. Please find the screenshot below:

2. We need to specify which columns represent effective-date columns by checking the Check 'Effective Date' check box and selecting 'Start' and 'End' radio buttons for the effective-date columns which represent Effective Start Date and Effective End Date. Find the screen shots below:


3. Optional: Change the data type of SysEffectiveDate attribute to 'java.sql.Date' from 'oracle.jbo.domain.Number'. We'll often find it easier with native Java sql data types instead of using Oracle's jbo datatypes. It is recommended to use java native sql type(java.sql.Date) for all date type attributes in the EO.

That's it. Now, your EO is date-effective and supports date-effective operations on it's rows.

Wednesday, September 8, 2010

ADF Model: Creating Entity Object (EO)

ADF Entity Object (EO) is created based on database table. To create an entity object, follow the below steps:

1. Right click on your model project and select 'New'. Alternatively, you can select 'New Entity Object' right clicking the package name.

2. 'New Gallery' window opens -> Search for Entity Object -> Select 'Entity Object' and click 'OK'.

3. If the database connection is not yet defined, it'll open 'Initialize Business Components' wizard -> Click on '+' and it'll open 'Create Database Connection' window -> Give your database settings -> 'Test Connection' -> Click 'OK' when the connection is success.

4. It'll select the created DB to create all business components.

5. Now, 'Create Entity Object' wizard appears -> In the 'Name' stop, Give Name for the EO, select/give package for the EO. And, you can browse for existing schema objects by clicking on 'Browse..' and then search and select the DB table.

6. Click 'Next' -> The 'Attributes' section displays the all columns in the table selected and they'll become the EO attributes.

7. Click 'Next' -> In the 'Attribute Settings', you can give properties for your EO attributes. At least one column should be primary key (I selected EmpNo). Otherwise, it'll ask to have RowID as the Primary Key.

8. Click 'Next' -> The 'Java' section is for generating Java Impl files for EO. Click 'Next' -> You can optionally generate default View Object (VO) and Application Module (AM) for the EO.

9. Click 'Next' -> 'Summary' displays the summary of EO -> Click 'Finish'.

10. Now, you'll find the newly created EO in model project under the specified package.
Related Posts with Thumbnails