Vous êtes sur la page 1sur 2

OAF Important Points:

VO Substitution Queries:
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();
}
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 VORowImpl generated by the
Jdeveloper is modified 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);
}