Tuesday, 25 August 2015

LOV for Transient Attribute in Oracle ADF 11g

Today I will explain how to create LOV on transient attribute.
The scenario is in Employee Table there is no Department Name, but my requirment is in Employee table the department name should as LOV in database it should accept department Id.

For this First created Employee VO on Entity base.Created transient attribute on that VO.

After that I created LOV on that attribue and mapped departmentID aslo.


Create View criteria on Department VO whihc is taking parameter as department id. And that VO into that Employee VO as accessor and shuttule the view vriteria and map the department id to that view criteria.As below

 
In EmployeeViewRowImpl java class write the follwing code in transient getter attribute.
    /**
     * Gets the attribute value for the calculated attribute DepartName.
     * @return the DepartName
     */
    public String getDepartName() {
        RowSet row = this.getDepartmentRVO2();
        Row cuur = row.first();
        String str = (String)getAttributeInternal(DEPARTNAME);
        str = (String)cuur.getAttribute("DepartmentName");
        return str;
    }
In UI drag and drop as LOV. As below.


Thanks..:)