- Created: 21 December 2008
- Written by OracleTech
Now that you have DB schema and JDeveloper setup, you are ready to build and test your first service layer. It will take just 10 minutest to build these objects and test them with your database, all within JDeveloper. Make sure that the DB schema created earlier you is available and has all correck PK and FK defined and enabled in DB.
You can download this sample application if something goes wrong with steps.
Create New Project
- Launch JDeveloper and select Default Role.
- Create New Application and name it "FirstModel". Give appropriate source directory for this application.
- Select General Application from the list of templates. Click Next and Finish.
- Right click on project and "Erase from the Disk". This is because we will create a model project below that gives all needed libraries by default.
- Select New : Project and choose ADF Model as template
- Name the project as "MyModel" and click next
- Give appropriate default package like "focusthread.articles.model"
Create ADFbc using wizards
- Select New : Business Components : ADF Business Components : Business Components from Tables
- Click green "+" icon next to connections drop down to define a new DB connection using which you will create ADFbc. Use the DB shcema that you created earlier.
- Once you click OK, you are on step 1 of 6. Notice that the packages in each step will default according to the preferences we have set.
- Step 1 : Entity Objects. Click Query button to fetch all objects from DB. Select EMP, DEPT, LOCATION and BONUS tables.
- Select one of the table and notice the Entity Name below. JDev defaults it to EO becuase we used EO as suffix. Change this where it makes sense like EmpEO to EmployeeEO and DeptEO to DepartmentEO.
- Step 2 : View Objects. Select all fourn EO and shuttle to right side. Note that the name of the VO is defaulted to VO.
- Step 3 : Read Only View Objects. Do not select anything. We will talk about this later.
- Step 4 : Application Module. Give it a name HumanResourceAM.
- Step 5 : Business Component Diagram. Select the checkbox and give it hame HRADFbcDiagram. This is similar to DB Schema diagram and explains your object model.
- Review what you are generating and click finish.
- Expand the packages in the application navigator. Notice that there are assoications and view links created between entities based on the FK defined in the DB.
- Notice that in the HumanResourceAM, VOs are added and child VOs are added via the view links between then. Default VLs are created based on associations.
- Association, View Link and the VO names in AM are not following standard. We will talk about refactor feature going forward that lets us change this.