SQL

Sunday, 18 June 2017

Create Entity and View Controller



In this tutorial I will demonstrate how we can insert data into the database. For this purpose I have used the HR Schema. We will create a new application called HumanResource. We will automate the process to create all entity and view. There will be approximately 20 steps to follow.







 Model is the Business components of your application. You can put any name here.





After successfully create the model and view controller your projects will look like similar to this: 





Your application overview page should be open as soon as you create your projects Model and View Controller. Now Here we have option to create connection for the database and also Build the business services.



Make sure before you follow up the tutorial you have oracle database installed and have a database which has the HR Schema.


You can provide any Connection name as you like. Please provide HR user name and its password correctly. Also SID is the database name that contain your HR Schema. Don't forget to test connection before going to the next step. 


In the next step, we will configure our Business Services. Go to the Sup steps:


Make sure you select model in the pop up



Here it will ask again to configure the database which we already did previous step.


When you come up to this point press the Query button to get all the tables.


Select tables according to your needs and click the blue arrow to put them from left to right. You can also Name the entity as you like 



We are not creating any Query based view object here so skip to the next step


Rename the Application module if you like:


                                  You can create a diagram if you like but that's not required

Before you finalize these process you will have an option to see the summery



After successfully create the model and View controller projects, your application will look like the following:




Download: HumanResource.zip




Friday, 16 June 2017

Entity Object 1

Entity Object:

An Entity Object provides an Object Oriented representation of a row of a Database Table or a View.
It exposes access methods for its attributes that correspond to a table or view to access and manipulate the data. Attributes are simply the field or column of a table or a view. The ADF business components base class that implements the default entity behavior is EntityImpl.

<Entity> Impl

The Entity Implementation class (EntityImpl) class allows developer to expose typed attribute setter and getter methods , create attribute validations methods, access child collection in a master detail relation , retrieve the entity object key or modify the entity create and DML behavior.

<Entity> DefImpl

This class exposes methods to create new entity instances, find existinf entity instances and access entity properties.

Lets show an example:



Here EmployeeId is the primary key and it has a custom property CreateSequence which refers to database sequence EMPLOYEE_SEQ. If we intent to work with this property than <Entity>Impl may have following procedure to follow: