Validation in ADF Application (Using EntityImpl’s Method)

Validation in ADF Application (Using EntityImpl’s Method)

Today I’m going to start new series “Validation in ADF Application”. I’m using Jdeveloper 12c ( for that. ADF offers validation in three different layers.
• ADF View
• Model
• ADF Business Component

First I’ll cover validation on business service layer. ADF offers many ways to enable validation in attribute level. For e.g. you can use groovy expression, java method, and regular expression. So here we are going use java method to add validation rule to Salary attribute. In this example I’m using HR schema’s Employees table.

  1. Select Salary Attribute in Employees entity and go to validation tab.

  2. Then click on “Green Plus” icon to add new validation rule on attribute.
  3. On Dialog window select type to “Method”, as you can seen it will create method name validateSalary on EntityImpl class.

  4.  Then go to Failure handling tab and type validation message.

  5. Go to EmployeesImpl class and write validation logic
        public boolean validateSalary(BigDecimal salary) {
            boolean flag = true;
            String jobid = this.getJobId();
            if ("AD_PRES".equals(jobid)) {
                if (salary.doubleValue() < 50000) {
                    flag = false;
            } else {
                if (salary.doubleValue() < 10000) {
                    flag = false;
            return flag;

As you can see if job id is “AD_PRES”, salary must be greater than or equal to 50000 and for others job id it must be greater than or equal to 10000. Otherwise method will return false and error message shown to user.

Sample Code

About Manish Pandey

Manish is a Project Leader at Jagran Prakashan Ltd, focused on Jdeveloper Fusion Web Application(specifically Oracle ADF). He shares his knowledge through the OTN Jdev/ADF Forum. He has written more than 50 article about Oracle ADF and Jdeveloper.

One comment

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.