Wednesday 22 April 2015

OAF: Transient Attributes not getting populated in Extended VO

Recently I saw one question in OTN Forum on this topic "Transient Attributes not getting populated when we do VO Substitution". So I thought posting the solution here.


Scenario:

Standard VO has some transient attributes which gets populated by overriding the getter methods in the VORowmpl. When we extend this VO for adding some additional attributes, everything works except the original transient attributes. Those attributes are coming as null.


The reason is, when the extended VORowImpl is getting generated by the Jdeveloper, it will not call the super method (which is already overridden). So you need to modify the getter method of the Transient attribute in the extended VO to call the getter method in the Standard VO using super.


Standard VORowImpl getter method will be something like this :
 public String getAttribute1(){  
      return "Calculated Value";  
 }  

Generated getter method in the extended VORowImpl will be like this:
 public String getAttribute1() {  
      return (String) getAttributeInternal("Attribute1");  
 }  

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

Feel free to point out if anything is missing/wrong in this blog.

2 comments:

  1. Hello. I want to check with you. I am extending the expense report VO simply to add decode function on the select statement. When I install the extended VO one of the transient field (Withdraw) gets disabled. Do you know how to fix this?

    ReplyDelete
    Replies
    1. Didnt quite understand what do you mean by disabled.

      Delete