Wed. Jan 26th, 2022

Requirement: In this post we will see how we can set the default value for the different attribute of the Entity Object for every CreateInsert operation.

To do this we can wither follow the programmatic approach or the dynamic approach. I will discuss both in this post.

Solution: For the solution of the above requirement follow the steps as shown below:

Step 1: Create an Oracle ADF Fusion Web Application. Create a Business Components from Tables for the Departments table present in the HR schema of the Oracle Database 11g XE Edition.

Approach 1 : If we want to programmatically set the default values:

Go to the DepartmentsEO > Click Java > Click on the Edit icon

Check Generate Entity Object Class: DepartmentsEOImpl > Check Accessors > Check Create Method > Click OK

Open DepartmentsEOImpl and write the below code inside the create method. This will set the default values for the Location ID as 1700 and the default value for the Manager ID as 121.

     * Add attribute defaulting logic in this method.
     * @param attributeList list of attribute names/values to initialize the row
    protected void create(AttributeList attributeList) {

Approach 2 : If we want to dynamically set the default values:

To set the default value dynamically open DepartmentsEO > Click Attributes > Go to the Default Value section and set the default value either as Literal (hardcoded) or as Expression.

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 732 total views,  1 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *