View link trouble

I have a couple of tables as below:
CREATE TABLE year (
year NUMBER);
CREATE TABLE policy(
year NUMBER,
CONSTRAINT policy_year_fk FOREIGN KEY (year) REFERENCES year,
I created business components from these tables. While dealing with a PolicyViewRow, I would like to be able to traverse to the corresponding Year row. I edited the PolicyYearFkLink by clicking on the "In View Object" under "Generate Accessor" in the Source side of the "View Link Properties" tab. Then I exposed the getYearView method in PolicyViewRow.
When I call this method, I get an ArrayIndexOutOfBoundsException. Here's the stack trace:
java.lang.ArrayIndexOutOfBoundsException: 49
     java.lang.Object oracle.jbo.server.ViewRowStorage.getAttributeInternal(int)
     java.lang.Object oracle.jbo.server.ViewRowImpl.getAttributeInternal(int)
     oracle.jbo.Row com.grapevinecs.autoprivate.db.PolicyViewRowImpl.getYearView()
     void mypackage.Application1.main(java.lang.String[])
Why would such an error occur when all I have done is use generated methods?
Any help would be much appreciated!
Thanks,
Owen Gibbins

Never mind, I answered my own question (if it could be considered a question).
I had simply neglected to generate the accessors in the respective Entity object. Strange that it would allow you to generate it only in the View object if such an accessor requires the corresponding Entity object to be generated.

Similar Messages

  • View links in oracle ADF/query featching from Database

    Please any one help for this query
    I have two tables Emp, Dept
    I have query like this select * from Emp e, Dept d where e.deptno=d.deptno
    Query is fetching like this
    Empno Ename job Salary Comm deptno deptno dname      Loc
    15 i1     support     50000     11     5     5     IT          sss
    15 i1     support     50000     11     3     3     Account     sss
    16 i2     support     8000     10     5     5     IT          sss
    16 i2     support     8000     10     3     3     Account     sss
    16 i2     support     8000     10     3     3     Software      sss
    16 i2     support     8000     10     4     4     Operation      sss
    Query is fetching 6 rows.
    but my requirement is what ever records fetching from database with same employee number is one record that is same employee number dept names grouped I will show it as one record how to fetch records from data base.
    Here is the example (My Requirement):
    This is first row:
    Empno Ename job Salary Comm
    15 i1     support 50000     11
    Deptno dname      Loc
    5     IT          sss
    3     Account     sss
    This is second row:
    Empno ename job Salary Comm
    16 i2     support     8000     10
    Deptno dname      Loc
    5     IT     sss
    3     Account     sss
    2     Software sss
    4     Operation sss
    i am useing oracle ADF if any possibility in view links either i get from the query as i mentioned.
    plz any one can help
    thanks

    Please any one help for this query
    I have two tables Emp, Dept
    I have query like this select * from Emp e, Dept d where e.deptno=d.deptno
    Query is fetching like this
    Empno Ename job Salary Comm deptno deptno dname      Loc
    15 i1     support     50000     11     5     5     IT          sss
    15 i1     support     50000     11     3     3     Account     sss
    16 i2     support     8000     10     5     5     IT          sss
    16 i2     support     8000     10     3     3     Account     sss
    16 i2     support     8000     10     3     3     Software      sss
    16 i2     support     8000     10     4     4     Operation      sss
    Query is fetching 6 rows.
    but my requirement is what ever records fetching from database with same employee number is one record that is same employee number dept names grouped I will show it as one record how to fetch records from data base.
    Here is the example (My Requirement):
    This is first row:
    Empno Ename job Salary Comm
    15 i1     support 50000     11
    Deptno dname      Loc
    5     IT          sss
    3     Account     sss
    This is second row:
    Empno ename job Salary Comm
    16 i2     support     8000     10
    Deptno dname      Loc
    5     IT     sss
    3     Account     sss
    2     Software sss
    4     Operation sss
    i am useing oracle ADF if any possibility in view links either i get from the query as i mentioned.
    plz any one can help
    thanks

  • View Link between two query views

    Hi is it possible to create a view link between two views having the where clause bind variables.
    How you set the bind variables at the run time for the View objects. It is giving hard time for me to use the Master view in the XmlData bean to generate the Xml document.
    I am able to set the Master views bind variables, but for view link destination view
    where clause bind variables are not able to set ( link object link condition bind variables are binded run time but the views where chause bind variables of destination view are unable to setand bind)
    Thanks
    null

    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.

  • [SOLVED] Multiple Dynamic View Objects and View Links - ADF Tree Table

    Hi all,
    I've got a method that creates 3 dynamic viewobjects using this:
                ViewDefImpl Level1ViewDef = new ViewDefImpl("Level1View");
                Level1ViewDef.addViewAttribute("LevelDescription","LEVEL1_DESCRIPTION",String.class);
                Level1ViewDef.addViewAttribute("SetOfBooksId","SET_OF_BOOKS_ID",Number.class);
                Level1ViewDef.addViewAttribute("CodeCombinationId","CODE_COMBINATION_ID",Number.class);
                Level1ViewDef.addViewAttribute("Level1","LEVEL1",String.class);
                Level1ViewDef.addViewAttribute("AccountType","ACCOUNT_TYPE",String.class);
                Level1ViewDef.addViewAttribute("PeriodYear","PERIOD_YEAR",Number.class);
                Level1ViewDef.addViewAttribute("PeriodNum","PERIOD_NUM",Number.class);
                Level1ViewDef.addViewAttribute("PeriodName","PERIOD_NAME",String.class);
                Level1ViewDef.addViewAttribute("PtdActual","PTD_ACTUAL",Number.class);
                Level1ViewDef.addViewAttribute("YtdActual","YTD_ACTUAL",Number.class);
                Level1ViewDef.addViewAttribute("LtdActual","LTD_ACTUAL",Number.class);
                Level1ViewDef.addViewAttribute("BudgetName","BUDGET_NAME",String.class);
                Level1ViewDef.addViewAttribute("BudgetVersionId","BUDGET_VERSION_ID",Number.class);
                Level1ViewDef.addViewAttribute("PtdBudget","PTD_BUDGET",Number.class);
                Level1ViewDef.addViewAttribute("YtdBudget","YTD_BUDGET",Number.class);
                Level1ViewDef.addViewAttribute("LtdBudget","LTD_BUDGET",Number.class);
                Level1ViewDef.addViewAttribute("EncumbranceType","ENCUMBRANCE_TYPE",String.class);
                Level1ViewDef.addViewAttribute("EncumbranceTypeId","ENCUMBRANCE_TYPE_ID",Number.class);
                Level1ViewDef.addViewAttribute("PtdCommitment","PTD_COMMITMENT",Number.class);
                Level1ViewDef.addViewAttribute("YtdCommitment","YTD_COMMITMENT",Number.class);
                Level1ViewDef.addViewAttribute("LtdCommitment","LTD_COMMITMENT",Number.class);
                Level1ViewDef.setQuery(sql_level1);
                Level1ViewDef.setFullSql(true);
                Level1ViewDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);
                Level1ViewDef.resolveDefObject();
                Level1ViewDef.registerDefObject();
                ViewObject vo1 = createViewObject("Level1View",Level1ViewDef);I can create the view objects fine and create a single viewlink between two of them, however i'm getting problems with 2 view links.
    This is how I'm creating a view link:
                ViewLink Level2Level1FKLink = createViewLinkBetweenViewObjects("Level2Level1FKLink1",
                                                        "Level2View",
                                                        vo1,
                                                        new AttributeDef[]{
                                                          vo1.findAttributeDef("Level1")
                                                        vo2,
                                                        new AttributeDef[]{
                                                          vo2.findAttributeDef("Level1")
                                                        "LEVEL1 = :Bind_Level1");
                ViewLink Level3Level2FKLink = createViewLinkBetweenViewObjects("Level3Level2FKLink1",
                                                        "Level3View",
                                                        vo2,
                                                        new AttributeDef[]{
                                                          vo2.findAttributeDef("Level2")
                                                        vo3,
                                                        new AttributeDef[]{
                                                          vo3.findAttributeDef("Level2")
                                                        "LEVEL2 = :Bind_Level2");I can get the data to display on an adf tree table if i'm only using a single view link, but when i try and implement 2 view link (for 3 levels on the adf tree table) i'm getting problems displaying the data.
    I'm getting the following error:
    Aug 10, 2007 2:44:39 PM oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer encodeAll
    SEVERE: Error during partial-page rendering
    oracle.jbo.NoDefException: JBO-25058: Definition Level3View of type Attribute not found in Level2View_Level2Level1FKLink1_Level2ViewThe thing is, Level3View isn't in the Level2Level1FKLink viewlink.
    I've been reading about something similar here
    BC4J Master-Detail-Detail
    but I am still unsure of what the problem is.
    Thanks in advance.

    I found the answer here:
    http://radio.weblogs.com/0118231/stories/2004/06/10/correctlyImplementingMultilevelDynamicMasterDetail.html

  • View objects, view links, does not search properly

    Hi,
    I am using Jdev 11.1.2.0
    I have created a search criteria based on view objects and view links. It has entities and entity associations as base. The structure is as follow:
    vo1 ->vl (1 to 1) - > vo2
    ->vl ( 1 to many) -> vo3
    Any search attribute which is not from vo1 return bad result. It happens in running app module and in the jspx page. In app module, it sometimes complains about populating the wrong attribute for the named criteria.
    The search criteria is using "exists" statement for vo2 and vo3 for adding the conditions. It has many attributes within the exist statement.
    So what is the problem. Why it does not join properly? Why does it return bad result when search attribute is from vo2 and vo3? Please help.
    Any more information requires to solve the problem?
    Thanks,
    Arthur

    Hi,
    Two more information: vo1 is composed of Entity1 (1..M) Entity2 and Entity1 (1..1) Entity 3. vo2 is composed of Entity 2 and vo3 is composed of Entity 4.
    I follow the information from http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcquerying.htm#BCGIFHHF
    to create the search criteria.
    Arthur

  • EJB Finder View Links and CMR

    Hi,
    Can someone please give me some input on the following warning in the JDeveloper online help!
    "Warning: You cannot create an EJB finder view link that expresses the same relationship as a CMR."
    I'm new to EJB, BC4J and JDeveloper. I created container managed entity beans with local interfaces only to represent my data and relationships. No problems with the mapping so far.
    To test the beans I used Session Facades with remote interfaces and build a sample test client.
    Now I thought I could create EJB Entity Facades, EJB Finder View Objects, EJB Finder View Links and EJB Application Modules to make use of the BC4J framework in order to speed up programming clients (JSP and JClient).
    So I've started studying the JDeveloper online help (which seems to be very useful) and found the above mentioned warning.
    Well, better a warning than nothing at all, but some more explanations would have been even better.
    Is there no need to use view links with CMR?
    How to achieve the same functionality (synchronizing two view objects in a master-detail-relationship) with CMR?
    Do you know any examples? I couldn't find any examples using EJB entity facades in the "sample code" area on OTN.
    Any comments about other (better) architectures are also welcome. Would it be better to use BMP entity beans in conjunction with BC4J?
    Many thanks for your help!
    Regards,
    Eric

    Steven,
    thank you for your reply and suggestions - I'll count on that. If I find time I'll read this book. It seems to be very interesting.
    For educational purposes I'd like to look at both persistence implementation strategies. I agree that it looks definitly easier to use entity objects. Certainly it's also performancewise a better choice.
    Anyhow, could you give me some useful tips for cmp entity beans and finder view objects?
    Is there something which works completely different if I use BC4J on top of it?
    How to implement a master-detail relationship in JClient (Swing) for example?
    What about writing an ejbfinder which doesn't return all, but all data where the foreign key is equal to a parameter passed to the finder method and use this as the source for a detail view object. This could be the primary key of the selected master. Well, I don't know whether this is doable. But that's what comes to my mind spontaneously.
    Would this be a solution? I'm still thinking about the aforementioned warning in the online help regarding view links.
    I guess the problem is that the foreign key is not part of the entity bean as it's not a cmp-field. Instead you have accessor methods to retrieve a related object or a collection of objects.
    I'm sure my questions are not too complicated to answer. It's only hard for a beginner to get an overview.
    I'm quite confident that I'll manage this if I give my best and get some help from knowledgeable people like you Steven.
    Regards,
    Eric

  • ADF BC: both ID and view link object as getter/setter in row impl

    I notice something when generating the row implementation of VO that have links to other VO. I can't seem to find the logic behind it...
    Following model:
    users( id, address_id,name,firstname,...)
    address(id, street,number,...)
    their is an assosiation between the UsersEO and the addressEO. Their is also a view link between the UsersVO and the AddressVO based upon the assosiation of the EO's.
    When we create the row implementation of the UsersVO we find a getter and setter for both the address_id as well as the address row object.
    Why is this?
    We have this issue because i added the UsersVO and the addressVO to the app module but i haven't added the link to the appModule but when i create the SDO from the appModule, the Users has both the address_id as the address row object.
    THis does not seem to make sense. How do you use it correctly? Do you just need to set the address_id and can leave the row object null or do they both need to have the same? What if you set the address_id to 1 but the id in the address row object is set to 5...
    How do the databindings handle these things?
    To me it seems more logical that the VO only has a getter and setter for the address object and handles the address_id in the background according to the values in the address object.
    Can someone explain me why this is implemented this way and how to handle it correctly?
    Edited by: Yannick Ongena on Sep 27, 2010 5:29 PM

    Yannick Ongena wrote:
    When we create the row implementation of the UsersVO we find a getter and setter for both the address_id as well as the address row object.
    Why is this? The definition of the VL allows you to optionally generate accessors for the underliying VOs, i.e. getAddressVO() in the UsersVO and getUsersVO() in the addressVO.
    We have this issue because i added the UsersVO and the addressVO to the app module but i haven't added the link to the appModule but when i create the SDO from the appModule, the Users has both the address_id as the address row object. You should add the addressVO to the AM using the VL instead and not by itself.
    THis does not seem to make sense. How do you use it correctly? Do you just need to set the address_id and can leave the row object null or do they both need to have the same? What if you set the address_id to 1 but the id in the address row object is set to 5...
    As mentioned above, once you add the addressVO to AM using the VL, the framework will take care setting the value of the row objects accordingly.

  • 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.

  • Add/remove view links at runtime !?

    Hi,
    how can i add/remove a view link to an already published RowSet and make the RowSet adapt to the new condition ??? (without loosing it's own linked Details)
    The scenario: I have lot's of details which are linked to the same master. I remove the details from the session (sessionInfo.removeRowSet) when I don't need them to keep the active number of views in the session as small as possible ! When removing the Details from the Session I also have to remove their links to the master (to avoid exceptions). Further I want to establish the links again when the detail is added to the session again !?
    I add links before publishing:
    ViewLinkInfo view_12aLink = new ViewLinkInfo(master, "package1.LinkDef");
    view_12a.addMasterLink(view_12aLink);
    I can remove links after publishing with:
    view_12aLink.removeViewLink(sessionInfo1.getApplicationModule());
    but how to establish the link again ?:
    ApplicationModule appMod = ....;
    ViewObject vo = appMod.findViewObject(view_12a.getQueryInfo().getName());
    view_12aLink.createViewLink(appMod,vo);
    doesn't work !
    if (view_12a.isOpen())
    view_12a.close();
    view_12a.addMasterLink(view_12aLink);
    works !, but all the links where view_12a is master are broken !!!!
    So what to Do ????
    Thanks for every answer !
    null

    Your results are as expected per the imlementation. Basically you've established (two) ViewLinks between two sets of two instances of VOs.
    Now you try and get an accessor to return a set of details. You need to establish a link between that detail set and it's details to use the accessor on the second detail to get the desired results. Basically you've to establish the chaining between appropriate instances of VOs and not just the outer VOs or VO members of your AM.

  • Bug in bc4j?, view links at runtime, multi table relationships, accessor name

    The following seems like a bug in the business components framework
    to me:
    To make things simple, I will use view objects aV, bV, cV,
    corresponding rows aR, bR, cR and row iterators aI (not used though),
    bI, cI.
    I create two view links from aV to bV and from bV to cV at runtime,
    with the accessor names "Bs" and "Cs".
    ViewLink a2b = createViewLinkBetweenViewObjects(..., "Bs", ...);
    ViewLink b2c = createViewLinkBetweenViewObjects(..., "Cs", ...);
    First of all this code works perfectly fine:
    ViewObject aV = a2b.getSource();
    ViewObject bV = a2b.getDestination();
    ViewObject cV = b2c.getDestination();
    while(aV.hasNext())
    Row aR = aV.next();
    System.err.println("aR");
    while(bV.hasNext())
    Row bR=bI.next();
    System.err.println(" bR");
    while(cV.hasNext())
    Row cR=cI.next();
    System.err.println(" cR");
    Using the accessor name "Bs" at the first level is ok, too:
    ViewObject aV = a2b.getSource();
    while(aV.hasNext())
    Row aR = aV.next();
    System.err.println("aR");
    RowIterator bI=(RowIterator)aR.getAttribute("Bs");
    while(bI.hasNext())
    Row bR=bI.next();
    System.err.println(" bR");
    HOWEVER, USING THE ACCESSOR "Cs" AT THE SECOND LEVEL OF THE MULTITABLE
    RELATIONSHIP IN THE FOLLOWING CODE, GIVES ME AN EXCEPTION
    oracle.jbo.NoDefException: JBO-25002: Definition Cs of type Attribute
    not found. THE SEEMS LEGAL USAGE OF THE ACCESSOR "Cs" TOO ME THOUGH,
    THEREFORE MY SUSPICION OF A BUG.
    ViewObject aV = a2b.getSource();
    while(aV.hasNext())
    Row aR = aV.next();
    System.err.println("aR");
    RowIterator bI=(RowIterator)aR.getAttribute("Bs");
    while(bI.hasNext())
    Row bR=bI.next();
    System.err.println(" bR");
    RowIterator cI=(RowIterator)bR.getAttribute("Cs");
    while(cI.hasNext())
    Row cR=cI.next();
    System.err.println(" cR");
    (By the way, could make your window for filling in the message a little bit wider,
    making it easier to cope with the line breaks).
    Feedback is appreciated.
    Andreas Reuleaux
    Klopotek & Partner
    [email protected]
    null

    Your results are as expected per the imlementation. Basically you've established (two) ViewLinks between two sets of two instances of VOs.
    Now you try and get an accessor to return a set of details. You need to establish a link between that detail set and it's details to use the accessor on the second detail to get the desired results. Basically you've to establish the chaining between appropriate instances of VOs and not just the outer VOs or VO members of your AM.

  • Bug in View Link editor

    When creating a many-to-many view link based on a many-to-many association, the view object on the left must be based on the entity that was on the left when creating the association. Why is this? Surely it shouldn't matter.

    Just to add to this:
    If the view object on the left of the link is not based on the entity that was on the left when creating the underlying association then the accessors for the association will not be visible under the view in the link editor.

  • Bug in view link creation

    Here's an interesting bug in JDev 9.0.3.1, Win2k:
    I'm working with a view link using the Edit View Link dialog. It links two view objects, ViewA and ViewB, in a 1:* relationship. Entities EntityA and EntityB are the respective underliers of ViewA and ViewB. Under the View Link Properties node in the dialog, the only accessor generated is for the Destination view object.
    When I click OK, the column constants at the top of EntityA.java become messed up!!
    To be specific, all of the accessor column constants defined on the entity object are removed and then re-defined one line above the beginning of the column constants declaration section. They also are renumbered starting with zero, which causes them to have the same value as the first n column constant definitions. Naturally, this causes a "duplicate case label" compile error for the EntityA.java file.
    Even worse is if the column constant definitions start on the same line as the opening brace for the class, like so:
    public class EntityAImpl extends EntityImpl
    { protected static final int COLUMN_1 = 0;
    protected static final int COLUMN_2 = 1;
    // etc.
    The effect of clicking OK in the Edit View Link dialog is then to produce a ParseException error as the dialog is dismissed. Looking at the EntityA.java file, it's clear why:
    public class EntityAImpl extends EntityImpl
    protected static final int ACCESSOR_1 = 0;
    protected static final int ACCESSOR_2 = 1;
    // etc.
    { protected static final int COLUMN_1 = 0;
    protected static final int COLUMN_2 = 1;
    // etc.
    What puzzles me is:
    * Why is the entity object being affected at all, since the accessor was only supposed to be generated in ViewA?
    * Why are all the accessors being removed and re-added, even those that have nothing to do with the view link being edited?
    * Why, when the accessors are re-added, are the constant values duplicated?

    Please send a test case. I'm unable to reproduce this in a simple project in 9.0.3.1 or 9.0.3.2.
    Is there entity inheritance involved?
    Do your entity XML files mention _superAttr anywhere in them? If so, you might be hitting a known issue with 9.0.3 relating to entity inheritance at design time and the accessor attributes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • View links in multi table relations

    Is it advisable (in terms of performance e. g.), to create view links and view objects as local variables in multi table relations?
    examle: the jdev online help says to use
    such multi table relations like this:
    // A (one) -> B (many) -> C (many)
    ViewLink a2b = appMod.findViewLink("AtoB");
    ViewLink b2c = appMod.findViewLink("BtoC");
    ViewObject aV = a2b.getSource();
    ViewObject bV = a2b.getDestination();
    ViewObject cV = b2c.getDestination();
    while(aV.hasNext())
    Row aR = aV.next();
    while(bV.hasNext())
    Row bR = cV.next();
    while(cV.hasNext())
    Row cR = cV.next();
    I would rather keep everything concerning
    a, b, c together, especially when more
    tables (d, e, ...) are added, like this
    ViewLink a2b = appMod.findViewLink("AtoB");
    ViewObject aV = a2b.getSource();
    while(aV.hasNext())
    Row aR = aV.next();
    ViewLink b2c = appMod.findViewLink("BtoC");
    ViewObject bV = a2b.getDestination();
    while(bV.hasNext())
    Row bR = cV.next();
    ViewObject cV = b2c.getDestination();
    while(cV.hasNext())
    Row cR = cV.next();
    Is there anything to say against this approach (in term of performance for example). I am not sure to remeber,
    if this was the approach used in the HotelResevationSystem example.
    Thanks.
    Rx
    null

    For this to work you have to either build a view based on the entities from which you need attributes (joined by the FK) or build a ViewObject with the sql statement giving you all the attributes you need.
    The first case enables you the edit the attributes, the second gives you read only access to the attributes.
    What you try to do isn't a master-detail connection, you are doing a join of some tables.
    Timo

  • How to get the view link definition from the view link accessor

    Hi,
    I am using Jdev 10.1.3 and ADF BC. I am trying to do deep copy in a master/details view, after the new child record is created, I want to update the foreign key attribute. I know I can get the list of attribute definitions from the row in the view object, which include the view link accessors, I am wondering if I can get the view link definition from the view link accessors, so that I can get the source and destination attribute names.
    Thanks!

    Hi,
    you should get this through
    ViewObject vo = this.findViewObject("LocationsView1");
    int indx = vo.getAttributeIndexOf("DepartmentsView");
    ViewAttributeDefImpl vAttrDefImpl = (ViewAttributeDefImpl) vo.getAttributeDef(indx);
    ViewLinkDefImpl vdefImpl = (ViewLinkDefImpl) vAttrDefImpl.findViewLinkDefImpl();
    Note that this code starts from the ApplicationModuleImpl class, which is why I used this.findViewObject().
    Frank

Maybe you are looking for