Saturday, 2 May 2015

OAF: Issues associated with VO Substitution in Oracle Applications Framework - Part1

There are more and more questions coming in the OTN Forum with various issues with VO Substitution.


Most of these are related to one specific problem. I have initially posted a blog for a specific scenario 


Some other scenarios :
  • Able to change the values in the page, but after saving, the value is not getting changed in the database, but the screen shows  "Saved Successfully".
  • Null pointer exception thrown in the VOHelper class associated with the Standard VORowImpl.
Reason:
After debugging the code we found that in all the cases the the VORowImpl generated by the Jdeveloper is modifed in the Standard VORowImpl. Oracle Product development team has modified the getter and setter methods of the attributes for achieving the specific functionality. Some cases they have also overridden the setAttributeInternal() method.

What happens is, when you create a extended VO in the Jdeveloper, it creates its own RowImpl. The setter and getter methods are the default methods. When you substitute the VO, the framework calls the extended VO's getters and setters. So the logic written inside the standard VO's gets ignored.

Solution:
To fix (to retain the standard functionality), you need to modify the getter and setter methods of those attributes which is affected. You can look into the standard VORowImpl to see which all attributes have additional logic added. For all those attributes, you need to call super.xxxx().

Modify the getter method of the extended VORowImpl like this:
 public String getAttribute1() {  
      //return (String) getAttributeInternal("Attribute1");  
      return super.getAttribute1();
 }  

Modify the setter method of the extended VORowImpl like this:
 public void setAttribute1(String value) {  
      //setAttributeInternal("Attribute1",value);  
      super.setAttribute1(value);
 }  

Note: There might be exceptions also.
Feel free to point out if anything is missing/wrong in this blog. 

5 comments:

  1. Hi,
    i have issue with vo subtitution where in vo query i added custom sql with bind variable with binding style as seeded vo.
    it is substituted successfully, but the extended vo cant be execited while passing value to this new bind variable.

    ReplyDelete
    Replies
    1. You might need to give more details on this.. What is the error you are getting ?
      Is the substitution working fine without a bind variable ?

      Delete
    2. This comment has been removed by the author.

      Delete
  2. rectified the issue i was referring extended vo inside extended controller instead of seeded vo.

    ReplyDelete
    Replies
    1. Good.. Yes, you need to refer the standard VO, the framework automatically replaces the references with the substituted VO.

      Delete