Polymorphism in programmatic view objects

We are trying to benefit from viewobject polymorphism. We have Programmatic VOs that directly talk to a service and do not have any backing EOs. Hierarchy is like follows:
- Annot
- VisualAnnot
- StampAnnot
- TextAnnot
- NonVisualAnnot
We need to get a collection of polymorphic rows when we get a list of Annots. We have defined StampAnnot and TextAnnot as subtypes of Annot in AM. However, all the rows that we get are of type Annot with the minimal set of attributes Annot should have, and not the StampAnnot or TextAnnot with additioanal attributes.
We tried overwriting createRowFromResultSet() method in Annot VO so that we can generate the row of appropriate type. However, that also does not work because we still use ViewDef of Annot and attribute validation fails. Our questions are:
- Why polymorphism is not working in our case while we have defined a discriminator field and have the proper subtypes define in our AM? Should one must have EOs to make polymorphism work?
- If we need to overwrite some additional framework methods, any advice or sample to help us with that?
thanks and regards

Hello,
Steve Muench´s sample 132 implements what you are trying to accomplish. Inspect the sample and let us know if you have questions about it.
http://blogs.oracle.com/smuenchadf/resource/examples#132
Juan C.

Similar Messages

  • Programmatic View Objects + View Links

    Ive constructed some programmatic view objects to grab data from 2 custom java business services (for example: Persons and Addresses). The reasons for them being custom and separate are out of my control.
    I need to easily represent a relationship between these 2 view objects so Ive constructed a ViewLink between them. However I cant figure out exactly what ADF needs from me in terms of method implementations in my ViewObjects?
    When I drop the master data control onto a JSF via a Tree table, it looks as though its not actually filtering the detail rows. I.e. if master is a Person, and detail objects are Addresses, each Person tree node has all Addresses under it. Im assuming this is because the Address ViewObject is programmatic and so ADF doesn't know how to filter the results?
    How can I setup this ViewLink between 2 programmatic ViewObjects such that the ViewLink works like its supposed to?

    Hello,
    Steve Muench´s sample 132 implements what you are trying to accomplish. Inspect the sample and let us know if you have questions about it.
    http://blogs.oracle.com/smuenchadf/resource/examples#132
    Juan C.

  • View Link on two programmatic view objects

    Hello,
    I use Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407
    I have two programmatic View Objects with data from other sources (an ArrayList in my example).
    Now I would like to create a View Link on it. How can I do this?
    I'm quite new on Java and ADF...
    I know it is possible because I already found Steve's example 132 here [http://blogs.oracle.com/smuenchadf/examples/|http://blogs.oracle.com/smuenchadf/examples/]
    But could somebody create a simple example based on my example classes below (which is understandable for a newbie like me ;-) ?
    Has been asked already here, but I did not found a solution as yet.
    Error with view link and ADF table Tree
    This is my example code for the view objects:
    Employee.java:
    private Number empno;
    private String ename;
    private Number dept;
    with getters and setters...
    Department.java
    private Number deptno;
    private String dname;
    with getters and setters...
    public class StaticDataDepartmentsImpl extends ViewObjectImpl {
    int rows = -1;
    private List<Department> departments = new ArrayList<Department>();
    protected void executeQueryForCollection(Object rowset, Object[] params,
    int noUserParams) {
    // Initialize our fetch position for the query collection
    setFetchPos(rowset, 0);
    super.executeQueryForCollection(rowset, params, noUserParams);
    // Help the hasNext() method know if there are more rows to fetch or not
    protected boolean hasNextForCollection(Object rowset) {
    return getFetchPos(rowset) < rows;
    // Create and populate the "next" row in the rowset when needed
    protected ViewRowImpl createRowFromResultSet(Object rowset,ResultSet rs) {
    ViewRowImpl r = createNewRowForCollection(rowset);
    int pos = getFetchPos(rowset);
    populateAttributeForRow(r, 0, departments.get(pos).getDeptno());
    populateAttributeForRow(r, 1, departments.get(pos).getDname());
    setFetchPos(rowset, pos + 1);
    return r;
    // When created, initialize static data and remove trace of any SQL query
    protected void create() {
    super.create();
    // Setup string arrays of codes and values from VO custom properties
    initializeStaticData();
    rows = (departments != null) ? departments.size() : 0;
    // Wipe out all traces of a query for this VO
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    // Return the estimatedRowCount of the collection
    public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
    return rows;
    // Subclasses override this to initialize their static data
    protected void initializeStaticData() {
    Department d1 = new Department();
    d1.setDeptno(new Number(10));
    d1.setDname("IT");
    Department d2 = new Department();
    d2.setDeptno(new Number(20));
    d2.setDname("HR");
    departments.add(d1);
    departments.add(d2);
    // Store the current fetch position in the user data context
    private void setFetchPos(Object rowset, int pos) {
    if (pos == rows) {
    setFetchCompleteForCollection(rowset, true);
    setUserDataForCollection(rowset, new Integer(pos));
    // Get the current fetch position from the user data context
    private int getFetchPos(Object rowset) {
    return ((Integer)getUserDataForCollection(rowset)).intValue();
    public class StaticDataEmployeesImpl extends ViewObjectImpl {
    int rows = -1;
    private List<Employee> employees = new ArrayList<Employee>();
    protected void executeQueryForCollection(Object rowset, Object[] params,
    int noUserParams) {
    // Initialize our fetch position for the query collection
    setFetchPos(rowset, 0);
    System.out.println("in executeQueryForCollection");
    super.executeQueryForCollection(rowset, params, noUserParams);
    // Help the hasNext() method know if there are more rows to fetch or not
    protected boolean hasNextForCollection(Object rowset) {
    System.out.println("in hasNextForCollection. Rows:" + rows);
    return getFetchPos(rowset) < rows;
    // Create and populate the "next" row in the rowset when needed
    protected ViewRowImpl createRowFromResultSet(Object rowset,ResultSet rs) {
    ViewRowImpl r = createNewRowForCollection(rowset);
    int pos = getFetchPos(rowset);
    System.out.println("in createRowFromResultSet. Pos=" + pos);
    populateAttributeForRow(r, 0, employees.get(pos).getEmpno());
    populateAttributeForRow(r, 1, employees.get(pos).getEname());
    populateAttributeForRow(r, 2, employees.get(pos).getDept());
    setFetchPos(rowset, pos + 1);
    return r;
    // When created, initialize static data and remove trace of any SQL query
    protected void create() {
    super.create();
    // Setup string arrays of codes and values from VO custom properties
    initializeStaticData();
    rows = (employees != null) ? employees.size() : 0;
    System.out.println("in create(). Rows=" + rows);
    // Wipe out all traces of a query for this VO
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    // Return the estimatedRowCount of the collection
    public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
    return rows;
    // Subclasses override this to initialize their static data
    protected void initializeStaticData() {
    Employee e1 = new Employee();
    e1.setEmpno(new Number(2333));
    e1.setEname("Emp1");
    e1.setDept(new Number(10));
    Employee e2 = new Employee();
    e2.setEmpno(new Number(1199));
    e2.setEname("Emp2");
    e2.setDept(new Number(20));
    Employee e3 = new Employee();
    e3.setEmpno(new Number(3433));
    e3.setEname("Emp3");
    e3.setDept(new Number(10));
    Employee e4 = new Employee();
    e4.setEmpno(new Number(5599));
    e4.setEname("Emp4");
    e4.setDept(new Number(20));
    Employee e5 = new Employee();
    e5.setEmpno(new Number(5676));
    e5.setEname("Emp5");
    e5.setDept(new Number(10));
    Employee e6 = new Employee();
    e6.setEmpno(new Number(7867));
    e6.setEname("Emp6");
    e6.setDept(new Number(20));
    employees.add(e1);
    employees.add(e2);
    employees.add(e3);
    employees.add(e4);
    employees.add(e5);
    employees.add(e6);
    // Store the current fetch position in the user data context
    private void setFetchPos(Object rowset, int pos) {
    if (pos == rows) {
    setFetchCompleteForCollection(rowset, true);
    setUserDataForCollection(rowset, new Integer(pos));
    // Get the current fetch position from the user data context
    private int getFetchPos(Object rowset) {
    return ((Integer)getUserDataForCollection(rowset)).intValue();
    Who can help?
    Thnx in advance!
    Rolf

    Rolf,
    I guess when we try to do it for you, we end up with almost the sample code provided by Steve Muench.
    So there from my point of view it doesn't make sense to do it all over.
    Take some time and study the sample code, run it without changes and after that try some changes which suits your use case better.
    If you don't understand what's going on in the sample post the question here and we try to help you.
    Timo

  • View Links for Programmatic View Objects

    Hi All,
    I created a read only VO called MyVO based on a sql query.
    I created 2 programmatic view objects, MasterView and ChildView.
    In a custom method in AMImpl class ,I iterate through this MyVO resultset and get the rows in a Row object.
    Based on some attributes values of the Row, I populate both master and child View Objects.
    I have created a view link between Master and Child Programmatic View Objects and have exposed them in AM.
    Now I run the AM, and run the method exposed in client interface.
    Now I click on my master and child programmatic views.
    I see that the rows are populated in both of these programmatic VOs.
    But when I click on viewlink which I have exposed under master, it doesnt show me any
    record for child.
    This is my method of AMImpl which is exposed in AM client interface.
    public void constructLines(){
    ViewObject vo= this.getMyVO1();
    ViewObject master=this.getTransientVO1();
    ViewObject child=this.getTransientLineVO1();
    Row r,masterRow,childRow;
    int count=0;
    while(vo.hasNext()){
    ++count;
    r=vo.next();
    masterRow = master.createRow();
    if(r.getAttribute("QuoteHeaderId")!=null)
    masterRow.setAttribute("QuoteHeaderId",
    r.getAttribute("QuoteHeaderId").toString());
    if(r.getAttribute("QuoteLineId")!=null)
    masterRow.setAttribute("QuoteLineId",
    r.getAttribute("QuoteLineId").toString());
    if(r.getAttribute("LineNumber")!=null)
    masterRow.setAttribute("LineNumber",
    r.getAttribute("LineNumber").toString());
    master.insertRow(masterRow);
    childRow= child.createRow();
    if(r.getAttribute("RefLineId")!=null)
    childRow.setAttribute("RefLineId",
    r.getAttribute("QuoteLineId").toString());
    if(r.getAttribute("QuoteHeaderId")!=null)
    childRow.setAttribute("QuoteHeaderId",
    r.getAttribute("QuoteHeaderId").toString());
    child.insertRow(childRow);
    This is stopping me from my development progress.
    Any suggestion to solve this will be of great help.
    Thanks,
    Prabhanjan

    Hi..
    have you define relationship correctly between masterVO and childVO.sometime there may be the problem.

  • Changing a Programmatic View Object's query at run-time

    Hi,
    I've created a programmatic View Object using the information in '35.9.3 Key Framework Methods to Override for Programmatic View Objects' in the Oracle Middleware Fusion Guide and bound it to a BarChart. This has worked fine using the following:
    String myColumn = "Quant1";
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    String myQuery = "SELECT Service as MyService, " + myColumn + " as MyValue FROM ColumnTestTable WHERE 1 = 1";
    getViewDef().setQuery(myQuery);
    setQuery(myQuery);
    I also have my data updating automatically. I have public properties in my viewObjImpl class which I can set and update the value of myColumn. I then thought it would just be a case of re-calling the create() method and the SQL would be updated and my chart would auto-update using the new column to select it's values, the value of the property updates and the create method is called but the chart doesn't display any different data and stops auto-updating. Does anybody know if this is possible and if so what I may have missed?
    Cheers, Tom

    Hi Timo,
    I moved everything to a different public method and solved the problem by firing the execute() method which I hadn't been doing previously and the chart updates with the correct data.
    However, once I execute the SQL my chart stops auto-updating with changes to the data in the database - do you know how I update the SQL query but keep my chart auto-updating? Perhaps I have to re-register for the registerDatabaseChangeListener for the query collection?
    Thanks in advance, Tom

  • Issue in programmatic view object.

    Hi,
    I am creating a programmatic view object, in a button's action listener. I have used ViewObject.clearcache() to flush the VO previous data, every time the button is clicked and load new data. The issue which i face, is that the table showing the VO data, shows data in alternate attempts i.e. 1st,3rd and 5th button click and in the 2nd, 4th click it shows "No data to display." . If i try using ViewObject.reset() the table is loaded with data every time but the new result set gets appended, which gives duplicate data.
    Please help.
    Regards,
    Max

    Hi Navaneeth,
    The code snippet is :
    DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dciterator=bindings.findIteratorBinding("AccountSummaryMCANViewObj1Iterator");
    ViewObject serviceVO=dciterator.getViewObject();
    webGetVruxDataService = new WebGetVruxDataService();
    WebGetVruxDataPortType webGetVruxDataPortType =
    webGetVruxDataService.getWebGetVruxDataPort();
    Map<String, Object> requestContext =
    ((BindingProvider)webGetVruxDataPortType).getRequestContext();
    requestContext.put(BindingProvider.USERNAME_PROPERTY,
    "ladwpcom");
    requestContext.put(BindingProvider.PASSWORD_PROPERTY,
    "0bama8");
    System.setProperty("javax.net.ssl.trustStore",
    "/webdata/Oracle/Middleware/user_projects/domains/ladwp-test/security/cacerts");
    ObjectFactory objFact = new ObjectFactory();
    HostBridgeVruxRequestCt reqct =
    objFact.createHostBridgeVruxRequestCt();
    String autoPayment = "";
    if(serviceVO!=null)
    serviceVO.clearCache();
    for (int i = 0; i < canCount; i++) {
    // System.out.println(i);
    reqct.setCAN(userCANArray);
    serviceVO.insertRow(serviceVO.createRow());
    Row serviceVORow=serviceVO.getCurrentRow();
    HostBridgeVruxResponseCt responseCT =
    webGetVruxDataPortType.webGetVruxDataOperation(reqct);
    String acctName = responseCT.getVrux().getACCTNO();
    serviceVORow.setAttribute("ACCOUNTNAME", acctName);
    Double currBalance =
    Double.parseDouble(responseCT.getVrux().getTotalPendingAmount().toString());
    serviceVORow.setAttribute("CURRENTBALANCE", currBalance);
    //TODO code for date
    String dDate = responseCT.getVrux().getCDATE();
    String dMonth = dDate.substring(0, 2);
    String dDay = dDate.substring(2, 4);
    String formatteddate = dMonth + "/" + dDay;
    String dueDate = formatteddate;
    serviceVORow.setAttribute("DUEDATE", dueDate);
    if (responseCT.getVrux().getBANKFLG().equals("2")) {
    autoPayment = "Enrolled";
    } else {
    autoPayment = "Not Enrolled";
    serviceVORow.setAttribute("AUTOMATICPAYMENT", autoPayment);
    // System.out.println(serviceVORow.getAttribute("AUTOMATICPAYMENT"));
    serviceVORow.setAttribute("PAYNOW", "");
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.mcANTable);
    Regards,
    Max

  • Programmatic View Object

    I'm trying to create a programmatic view object from an Oracle Stored procedure that returns a single row containing Oracle Object Types. I created a Domain for my Oracle Object type called BillingInfo. Here is the code for my view object so far:
    package billing;
    import billing.common.BillingInfo;
    import java.lang.Integer;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import java.util.Date;
    import java.text.SimpleDateFormat;
    import oracle.jbo.JboException;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle Business Components for Java.
    public class BillingInfoViewImpl extends ViewObjectImpl
    // billing info procedure call variables
    private final static int BILLING_LOGGED_ON_USER_ID = 0;
    private final static int BILLING_BILL_TO_USER_ID = 1;
    private final static int BILLING_TRANSACTION_DATE = 2;
    private final static int BILLING_TRANSACTION_DETAILS1 = 3;
    private final static int BILLING_TRANSACTION_DETAILS2 = 4;
    private final static int BILLING_TRANSACTION_DETAILS3 = 5;
    private final static int BILLING_TRANSACTION_DETAILS4 = 6;
    private final static int BILLING_TRANSACTION_DETAILS5 = 7;
    private final static int BILLING_TRANSACTION_COUNT = 8;
    private final static int BILLING_TOTAL_CHARGE_AMOUNT = 9;
    private final static int BILLING_PAY_TYPE = 10;
    private final static int BILLING_ERROR_MESSAGE = 11;
    private final static int BILLING_ERROR_CODE = 12;
    private final static int BILLING_RETURN_VALUE = 13; /*
    * This is the PLSQL block that we will execute
    private static final String SQL =
    "begin ecs_jdbc_wrappers.get_billing_info_jdbc(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?, ?, ?);end;";
    * This is the default constructor (do not remove)
    public BillingInfoViewImpl() { }
    * Overridden framework method.
    * Executed when the framework needs to issue the database query for
    * the query collection based on this view object. One view object
    * can produce many related result sets, each potentially the result
    * of different bind variable values. If the rowset in query is involved
    * in a framework-coordinated master/detail viewlink, then the params array
    * will contain one or more framework-supplied bind parameters. If there
    * are any user-supplied bind parameter values, they will PRECEED the
    * framework-supplied bind variable values in the params array, and the
    * number of user parameters will be indicated by the value of the
    * numUserParams argument.
    protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
    * If there are where-clause params they will be in the 'params' array.
    * NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
    * ---- but this parameter value should be oracle.jbo.domain.Number type.
    int sqlcode = 0; // statement sql code
    String errorMessage = null; // statement error message
    String loggedOnUserId = null; // IN VARCHAR2
    String billToUserId = null; // IN VARCHAR2
    Date transactionDate = new Date(); // IN DATE
    BillingInfo transactionDetails1 = null; // IN OUT billing_info
    BillingInfo transactionDetails2 = null;
    BillingInfo transactionDetails3 = null;
    BillingInfo transactionDetails4 = null;
    BillingInfo transactionDetails5 = null;
    int transDetailsCount = 0; // IN INTEGER
    String payType = null; // IN VARCHAR2
    if (params != null)
    loggedOnUserId = (String)params[BILLING_LOGGED_ON_USER_ID];
    System.out.println("USER ID:" + loggedOnUserId);
    billToUserId = (String)params[BILLING_BILL_TO_USER_ID];
    System.out.println("BILLED USER ID:" + billToUserId);
    if (params[BILLING_TRANSACTION_DETAILS1] != null) {
    System.out.println(params[BILLING_TRANSACTION_DETAILS1]);
    transactionDetails1 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS1];
    transDetailsCount = transDetailsCount + 1;
    if (params[BILLING_TRANSACTION_DETAILS2] != null) {
    transactionDetails2 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS2];
    transDetailsCount = transDetailsCount + 1;
    if (params[BILLING_TRANSACTION_DETAILS3] != null) {
    transactionDetails3 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS3];
    transDetailsCount = transDetailsCount + 1;
    if (params[BILLING_TRANSACTION_DETAILS4] != null) {
    transactionDetails4 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS4];
    transDetailsCount = transDetailsCount + 1;
    if (params[BILLING_TRANSACTION_DETAILS5] != null) {
    transactionDetails5 = (BillingInfo)params[BILLING_TRANSACTION_DETAILS5];
    transDetailsCount = transDetailsCount + 1;
    payType = (String)params[BILLING_PAY_TYPE];
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Set the value of the bind variables
    st.setString(1, loggedOnUserId);
    st.setString(2, billToUserId);
    // Set Transaction Date to todays date
    java.sql.Timestamp sqlTs = new java.sql.Timestamp(transactionDate.getTime());
    st.setTimestamp(3, sqlTs);
    System.out.println("TRANS DATE:" + sqlTs);
    st.setObject(4, transactionDetails1);
    if (transactionDetails2 == null) st.setNull(5, Types.STRUCT, "BILLING_INFO");
    else st.setObject(5, transactionDetails1);
    if (transactionDetails3 == null) st.setNull(6, Types.STRUCT, "BILLING_INFO");
    else st.setObject(6, transactionDetails1);
    if (transactionDetails4 == null) st.setNull(7, Types.STRUCT, "BILLING_INFO");
    else st.setObject(7, transactionDetails1);
    if (transactionDetails5 == null) st.setNull(8, Types.STRUCT, "BILLING_INFO");
    else st.setObject(8, transactionDetails1);
    st.setInt(9, transDetailsCount);
    st.setString(11,payType);
    * Register OUT paramters
    st.registerOutParameter(4, Types.STRUCT, "BILLING_INFO");
    st.registerOutParameter(5, Types.STRUCT, "BILLING_INFO");
    st.registerOutParameter(6, Types.STRUCT, "BILLING_INFO");
    st.registerOutParameter(7, Types.STRUCT, "BILLING_INFO");
    st.registerOutParameter(8, Types.STRUCT, "BILLING_INFO");
    st.registerOutParameter(10, Types.DOUBLE);
    st.registerOutParameter(12, Types.VARCHAR);
    st.registerOutParameter(13, Types.INTEGER);
    st.registerOutParameter(14, Types.INTEGER);
    // execute the stored procedure
    st.execute();
    // get the SQLCODE
    sqlcode = st.getInt(13);
    System.out.println("sqlcode returned:" + sqlcode);
    errorMessage = st.getString(12);
    System.out.println("Error Message:" + errorMessage);
    catch (SQLException s) {
    System.out.println("sqlcode returned:" + sqlcode);
    System.out.println("Error Message:" + errorMessage);
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    super.executeQueryForCollection(qc, params, numUserParams);
    This almost works except when I try to print out the attributes I get an error. I beleive I have to override some of the view object framework methods. If so, how do I go about this? Is it the same methods overridden in this example Getting a View Object's Result Rows from a REF CURSOR? http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html
    Nat

    Yes. only difference is that your VO will just have one row in it.

  • ViewLink between DB and Programmatic View Objects

    Im using programmatic view objects as described in #132 of http://blogs.oracle.com/smuenchadf/resource/examples
    I can create view links between these programmatic view objects, but when I create a ViewLink from a DB ViewObject to a programmatic view object, the programmatic one fails to see the view link when invoked, and therefore doesnt return the correct detail objects.
    Has anyone created a view link like this before? If so, can I see the code or an example?

    If you look at example #132 above, you'll see a ListOfMapsDataProviderViewObjectImpl - which is a custom ViewObject that delivers data programmatically. There's a method in this object "getFilterCriteria(..)" that looks at the parameters delivered to the ViewObject, and any ViewLinks, to produce a map of parameters that the underlying DataProvider can use to filter its data. When you setup a ViewLink between two of these ViewObjects you may see a filter on a foreign key, since the master view object is retrieving its detail objects. However, when the master object is a standard database view object, the view link doesnt work, i.e. the getFilterCriteria method does not see the view link when it calls ViewObjectImpl.getViewLinks().

  • Populate Programmatic View Objet at runtime

    Hi All,
    I have a requirement to switch between three different data source at runtime in one page. The UI and field names are the same for those three cases but data is coming from different sources (queries).
    So, imagine that we have 3 view objects that implemented as read only (query based view object) and we want to populate one view object at runtime as a main data source for my page.
    My idea is to use "Prgorammatic View Object" for that main data source and then dynamically populate its content from one of the three read-only view objects based on a parameter provided by user selection.
    First of all, I want to know whether this is fine approach and if so, then get some points about implementation or any other sample.
    I have found this sample:
    http://techiecook.wordpress.com/2011/05/17/programmatically-populate-view-objects-in-oracle-adf/
    Thanks in advance,
    Nasser

    Hi,
    this more is a use case for adaptive bindings. See:https://blogs.oracle.com/groundside/entry/towards_ultra_reusability_for_adf
    You can use EL to change the ViewObject name an iterator in ADF queries its data from. So the switch would be on the binding layer and there is no need for programmatic view objects. Unlike in the above blog article, the 3 VO exist in your case so you don't need to create them on the fly. Just change the VO name in the referenced managed bean
    Frank

  • ADF View Object filtering

    Hi, This question is related to ADF table filters.
    Let us take an example of a View Object that is being dropped in a jspx page as a "ADF Table" with filters.
    Whenever user applies a filter on a column, will the data for view object be queried from database once again?
    Is there a way to avoid the query re-execution on applying filters in table.

    Thanks for the replies. Jdeveloper version we use is 11.1.1.6.
    I have a follow up question.
    We have a programmatic View Object which gets data from 3 different rows and populate them in view rows (We have overridden standard methods like executeQueryForCollection..etc)
    The data is displayed in a ADF table.
    Now when the user filters data, normally filter works fine but the web service calls are made every time the filters are applied/removed.
    We would like to avoid making calls to web services when user filters data by setting Query Mode to "QUERY_MODE_SCAN_VIEW_ROWS".
    But what happens is first time filter is applied, the filtered rows are displayed properly but from there on the query collection refers to filtered data only and not the complete data set.
    So when the user removes filter and hits enter again only filtered rows are displayed and not all the rows fetched initially. I am not sure why the query collection looses all the rows and keeps only filtered rows??

  • Where the programmatic views will be stored in Database.

    Hi, All
    what will be the scope of the views which are created programmatically in database.
    will they store in any temporary tabels in the database, could anybody provide any Idea.
    Thanks in Advance.
    Renuka

    Renuka,
    Even though we do not require any database object like (views / synonyms) to create programmatic view object we need a database connection to initially create the ProgViewObject. From where does your data come from? Other Datasources than DB?
    And as you explained ViewObjects will only be occupied in Application Level not in the DB Used for BC Objects.
    In that case even if we have ProgViewObjects in BC project in a big number is should not be a performance impact from the Application side on the underlying used DB for that App. Correct???????? Not really. ViewObjects themselves does not need any space in DB (they are simple XML files - with or without related java classes). However, the VO would need to contact the DB for fetching the data. If you are not using the Database (that you've used to create a connection), to fetch the data (and using some other Data Source), then the answer for your question is Yes. There would not be a performance impact on the underlying DB. However, there would be on the Data Source you are using for the Programmatic VOs.
    -Arun

  • How to create ADF UI based on polymorphic view objects

    Hi,
    I'm using JDeveloper build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. I created a simple application based on Steve's example #10 [url http://blogs.oracle.com/smuenchadf/examples/]ViewRow and EntityObject Polymorphism.
    I added a men-only attribute "Age" to the "Men" VO and filled it with an arbitrary value in MenRowImpl.java:
    public String getAge() {
         return (String) "45";//getAttributeInternal(AGE);
    }Running the TestModule works perfectly - a row of type "Men" displays the "Age" attribute whereas a row of type "Women" doesn't.
    Afterwards, I setup an ADF ViewController Project and created a JSPX with a read-only form based on the "People" datacontrol with navigation buttons. Running that page always shows the same set of attributes independent of the row type. That's expected behaviour because the binding is defined at design time.
    So my question is: can I somehow achieve the same behaviour for polymorphic VOs as the business component tester shows?
    Kind regards,
    Markus

    Andrejus' example shows how to calculate different values for the same attribute based on overridden view objects. That's not exactly what I'm looking for. I need to display a (at least partly) different set of attributes that changes while the user scrolls through the records of the result set.

  • Using a polymorphic view object with binding

    Hi,
    I'm hoping there's something simple I'm missing when trying to setup up the bindings for a ADF/struts page using a polymorphic view object.
    I'm using Entity and VO polymorphism to create a Question which has different types - boolean, multi-choice, likert, etc. I have the various question types created as sub type entity and view objects and added to the app module - when added to the app module the question types are subtypes of QuestionView so they don't actually appear in the Data Controls palette. This setup is like that used in Steve Muench's examples (blog at http://radio.weblogs.com/0118231/stories/2003/02/06/constructingTheDesiredEntityInAPolymorphicViewObject.html and the related undocumented one)
    My question is, how do I get to the data and have jdev create the necessary bindings for the extra attributes the subtype questions have? Since they don't appear as available data controls I can't create a binding iterator or anything for them - short of adding them as spearate view objects (which destroys the whole point of using polymorphism in this case) is there a way to do this?
    Really, the only reason I want to use the polymorphism is so I can have different types of entity validation depending on the type. Should I just simplify this to be one entity object with one VO and put all the validation into "if else's" based on a discriminator?
    Assistance appreciated...
    - Nathaniel

    How else are you planning to associate a JUTableBinding to the 'common' iterator containing all four types of rows and then selectively display them? Perhaps you'd need a custom model over the JUTabelModel that'd filter the rows out.
    I'm not sure if all that trouble is worth it given that your datasets (as far as mentioned in this post) are not large. If these tables/data has to be refreshed/executed a number of times, then you may see the overhead of four queries otherwise it should be fine as database is always faster in filtering rows than doing that in memory.

  • Create view link between two view objects (from programmatic data source)

    Hi Experts,
    Can we create a link between two view objects (they are created from programmatic datasource ; not from either entity or sql query). If yes how to create the link; ( i mean the like attributes?)
    I would also like to drag and drop that in my page so that i can see as top master form and the below child table. Assume in my program i will be only have one master object and many child objects.
    Any hits or idea pls.
    -t

    Easiest way to do this is to add additional transient attributes to your master view object, and then include those additional transient attributes in the list of source attributes for your view link. This way, you can get BC4J to automatically refer to their values with no additional code on your part.

  • How to construct a new complete view object programmatically

    HI,
    I want to construct a new complete view object programmatically. I have a result set based on the rows returned from this query i need to build the new vo and show it n a form. Please tell me the complete procedure to do this or else provide me any links.
    Thanks
    Satya

    Hi,
    have a look how dynamic tables are created (using af:forEach to iterate the attribute Defs for generating columns). Your approach is similar except that you not only need to know about attributes but also the rows to fecth
    1. create a tree binding for the view object
    2. create the binding with one hierarchy
    3. ensure all attributes are deleted for the tree binding (you do this manually in the PageDef)
    4. when executing the query for a new SQL, call clearForRecreate() on the DCIteratorBinding instance
    5. On the page, use af:forEach to create the form fields and labels for each row. Like for dynamic tables, you first need to determine the attributes to render (its a nested loop you are going for
    6. Updates of the form fields must be through a managed bean
    Frank

Maybe you are looking for