JBO-27014 (Mandatory Attribute) Always Raised After JBO-27011 (Doc ID 465713.1)

Last updated on AUGUST 04, 2016

Applies to:

Oracle JDeveloper - Version 10.1.3.0.4 and later
Information in this document applies to any platform.
***Checked for relevance on 12-Sep-2013***

Symptoms


You have defined some validation rules on attributes in Entity Objects.
You developed an ADF Faces application and the end users complain about errors

JBO-27014: Attribute ... in ... is required

that are always displayed after a validation failed (JBO-27011), even when a value was entered for
the attribute.


-- Steps To Reproduce:

You can easily reproduce with this ADF BC code:

public class AppModuleImpl extends ApplicationModuleImpl {
    /**This is the default constructor (do not remove)
     */
    public AppModuleImpl() {
    }

    /**Container's getter for DeptView1
     */
    public DeptViewImpl getDeptView1() {
        return (DeptViewImpl)findViewObject("DeptView1");
    }
    
    public void createDept(Number deptno, String name, String loc) {
      String entityName = "validation.model.Dept";

      EntityDefImpl productDef = EntityDefImpl.findDefObject(entityName);

      EntityImpl newProduct = productDef.createInstance2(getDBTransaction(),null);

      newProduct.setAttribute("Deptno",deptno);
      newProduct.setAttribute("DName",name);
      newProduct.setAttribute("Loc",loc);
      try {

          getDBTransaction().commit();
      }
      catch (JboException ex) {
        getDBTransaction().rollback();
        throw ex;
      }
    }
    
    /**Sample main for debugging Business Components code using the tester.
     */
    public static void main(String[] args) {
        // Main method in SRServiceImpl.java
           
             String        amDef = "validation.model.AppModule";
             String        config = "AppModuleLocal";
             ApplicationModule am =
               Configuration.createRootApplicationModule(amDef,config);

             AppModuleImpl service = (AppModuleImpl)am;

             try {
               service.createDept(new Number(1),"Test","Test");
             }
             catch (JboException ex) {
               System.out.println("ERROR: "+ex.getMessage());
             }
             
             Configuration.releaseRootApplicationModule(am,true);
    }
}


when there is a Validation Rule defined on the Deptno attribute that it should be >= 10

Running this code will fail with the following errors:

Error

1. JBO-27011: Attribute set with value 1 for Deptno in AppModule.DeptView1 failed
2. JBO-27014: Attribute Deptno in AppModule.DeptView1 is required
3. JBO-27024: Failed to validate a row with key null of type AppModule.DeptView1



As you can see, the validation on Deptno fails, because we try to create a Deptno with value 1 (< 10).
Afterwards, the JBO-27014 (and JBO-27024 in this case as Deptno is the Primary Key) is raised, though a value for Deptno was set.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms