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

Similar Messages

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

  • View link between 2 public view object(PVO)

    Hi,
    Can we create a view link between 2 Public View Object(PVOs)? Is as same as creating view link b/w normal VOs.
    Regards,
    Suresh

    Hi,
    whats mean Public View Object? do you use BI?

  • 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

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

  • View Objects Fetch depth with View Links while creating Service Data Object

    Hi ,
    I am trying to create SDO's for my Business components.
    Here are my Entities & relations :
    Entity Objects : 1) EmployeeEo 2) DepartmentEO 3) PropertyEO
    And corresponding View Objects 1) EmployeeVO 2) DepartmentVO 3) PropertyVO.
    Associations : Employee -> Dept (m:1) , Employee -> Property (1:M) , And corresponding View Links as well.
    When i expose the VO's in AM like :
    DepartmentVO, with EmployeeVO from dept_emp_view link => This fetches all the data from Dept-> Employees -> Property
    However i don't want the tree fetch to be like that , i want to have my fetch restricted to only one level ie Dept-> Employees
    and a different fetch for Employees -> Property .
    Please suggest.
    Thanks !!

    Was able to do it by extending VO

  • View link accessor for master view object with bind variables

    Is there a way to set bind variables for a view object to which a view link accessor is used to retrieve a view row from a detail view row in a master-detail relationship ?
    I understand that RowSet (or Row) returned by a view link accessor originates from an "internally created" view object instance.
    I am using 10.1.3.0.4 JDeveloper.

    Thanks! that's right the bind variables when i use it on where clause must be required, so i change my sql to:
    Select /*+ use_nl(p p2) */
    'F' tipo_persona,
    p.ID_PERSONA, p.TDOC, p.NDOC, p.DENO
    From SINT_PERSONA p,
    ( Select /*+ index(a SINT_PERSONA_IX2) */
    a.ID_PERSONA
    From SINT_PERSONA_DOCUMENTO a
    where ( NDOC = :p_cuit
    and :p_cuit <> 0 )
    ) p2
    Where p.id_persona = p2.id_persona
    AND (deno = decode(:p_deno,'null',null,upper(:p_deno)) or
    :p_deno = 'null')
    AND (NDOC = decode(:p_ndoc,0,null,:p_ndoc) or
    :p_ndoc = 0)
    and grado_confiab > 0
    and my bind variables:
    p_ndoc required default value 0
    p_cuit required default value 0
    p_deno required default value null
    and works ok!
    thanks a lot !!!!

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

  • View link creation on two view objects, and both view objects are populated program(not from sql)

    I have master and detail VO , both views data is loaded in program. Now for show/hide feature, I create View Link Object and using one element from both child and master VO , View Link Object created properly.
    But I can not able to add that view link object into AM.
    Now because of that , I cannot say what is a instance name of that view link object.
    Hence getting following error  -- Invalid or missing view link. Please attach view link with the bean.
    Please can you provide some directions.

    I have master and detail VO , both views data is loaded in program. Now for show/hide feature, I create View Link Object and using one element from both child and master VO , View Link Object created properly.
    But I can not able to add that view link object into AM.
    Now because of that , I cannot say what is a instance name of that view link object.
    Hence getting following error  -- Invalid or missing view link. Please attach view link with the bean.
    Please can you provide some directions.

  • 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 Link with destination VO in expert mode

    I have view link with the destination View Object in expert mode for applying a custom query.
    The view link doesn't run nicely because it seems to never find the right table.
    Does anyone manage to create this kind of view link based on a custom query in the destination VO?
    Thanks
    Olivier.

    Hi,
    I had also the same problem, I needed to query two tables which are in a Master-Detail relationship, the only way to do this is to write a new bean, extendind the FindForm bean to make a query like this:
    select * from mastertable where condition4mt and pk_mastertable in ( select fk_pk_mastertable from detailtable where condition4dt)
    So after this you get a pointer in the master table, but your condition to the detailtable is not considered from the ViewCurrentRecord Bean. I didn't go further to extend the ViewcurrentRecord bean, because this solved my problem, besides I think it would be also very difficult.
    JDevTEAM !!! are you planing to solve this king of problem ???
    I know that I can force the VO.setWhereClause() to force some condition on the detail, but are you planing to extend the ViewCurrentRecord bean to have also a master-detail view with a restriction also on the detail table ???
    TIA,
    Seb.

  • Can I use View Link in ADF Creation Forms Jdev 10.1.3

    Hi...
    I created a view link of two tables. Then I created a ADF form with Master Object to show some informations.. and I created a ADF Creation form with the detail Object
    I'm trying to submit the informations added in the Detail forms.
    but no records are created in Database..
    Can I submit a creation form using detail object?
    Thanks

    I figured out "partially" the problem, I tried to overrid the create method, and for any reason the commit operation wasn´t working.
    I was trying to set a value for a proprety, but it did not work as a wish.
    My intention was.... when an user execute the form. one specific field brings a value.. however I cannot set default value. cause it´ll change sometimes.
    it´s something like this
    protected void create(AttributeList attributeList) {     
    super.create(attributeList);
    setMyProperty(new Number(0));
    do you know how can I figure out this problem?

  • View Link is not working???

    Hi Everyone,
    I have created one view link between two VOs (DeptVO and EmpVO).
    View link is based on DeptId attrtibute in both he views.
    Now i dragged DeptVO as Select One Choice in my ADF page by showing only Dept Name in soc1.
    And also dragged EmpVO as Select One Choice in my ADF page by showing only Emp Name in soc2.
    And run the page.
    After i modify any Dept in soc1 is not at all reflecting soc2. Whatever value i select in soc1 but soc2 values are not at all changing.
    What can i do to make it work?
    Any suggesetions will be really useful.
    Thanks.

    Hi Kumar,
    The link which I posted above contains the exact steps you are looking for. View Criteria is nothing to bother about, in simple terms it is just adding a WHERE clause to our SQL query (view object). So we are passing dynamic values to the WHERE clause of SQL query ( passing the user selected value to that WHERE clause i.e. department# selected by user from soc1). Please go through the link carefully and it should address all your questions.
    http://andrejusb.blogspot.com/2008/12/cascading-lovs-in-oracle-adf-11g-update.html
    Regards,
    Ravi Nuka.
    Edited by: Ravi Nuka on Apr 2, 2013 1:23 AM
    Edited by: Ravi Nuka on Apr 2, 2013 1:23 AM
    Edited by: Ravi Nuka on Apr 2, 2013 1:24 AM

  • How to rename a View Link in a data model?

    In JDeveloper 9.0.3, I create a simple BC4J project with a master and a detail. The business components are properly created.
    When I try to design the data model for the module, I am able to link the view for the master and the view for the detail, there is no problem to rename the view objects that I select in my data model, but I found no way to rename the view links used between the view objects.
    I always get an automatically generated name, like "FkForeignDetailLink1". This is what I see in the data model, and also in the structure of the module, in the "View Link Members" section.
    I am able to modify the properties of this view link, but not its name. Am I missing something?
    TIA

    to clarify... In the AM wizard, you are trying to rename the instances of view objects and view links?
    If so, you are right, there is no way to rename view links on that panel. We are working on a better way to do that for the next release. The only way I know of to rename the view links is to shut jdev down and edit the XML for the application modele. This can be dangerous if you get it wrong, so make a backup before attempting this. The hint with renaming things OUTSIDE JDeveloper, I already know, but I don't like much.
    As for the AM wizard, I just noticed that I cannot do it inside. But that's no problem for me, as lots of details cannot be done inside the wizard, but there is a way to customize them afterwards. My real problem is that didn't find ANY way of doing it.
    A question for you if I may. Why are you renaming the view link instances? I though most users would use the detail view instance directly. The detail view instance would in turn look up the appropriate view link into, what ever its name was. The only place where I saw the bad view link names displayed in JDev was the Structure pane of the AM, under View Link Members. But there is no way to modify them there. As for the detail view instance, I didn't find a place to get to the view link at design time (in 9.0.3.988).
    Could you be more precise, please?
    Thanks again,
    Adrian

  • 10g Preview: No way to rename view link usages in AM

    10g Preview (9.0.5.0.0 Build 1375), Win2k SP3.
    I generated the entity objects, view objects, associations, and view links from my DB structure. I created an application module with the default data model from the view objects and view links.
    I then renamed all of the view links using the Rename View Link dialog. The AM's xml file was correctly updated with the new names of the underlying view links, but the view link usages retained the old names.
    There does not appear to be a convenient way of renaming the view link usages in the AM. The workarounds are either to deconstruct the data model and then reconstruct it, or to manually edit the .java and .xml files.
    I would like to see, at minimum, the ability to rename the AM's usages via a right-click menu in the Structure pane. This would affect both view object and view link usages. Currently the only option available in the right-click menu is to edit the underlying business object, not the usage. It also would make sense to allow view link usages to be renamed from the Data Model page of the AM wizard.

    That worked beautifully. I didn't have the property inspector open originally, so it's nice to know there is a way to rename usages after all.
    I wonder if there's a usability issue here though... maybe it's just me, but with the ability to rename some things via the right-click menu in the navigator pane, it seemed natural to look in the very similar structure pane for the same sort of functionality. Now there's a third place to look. Perhaps if the right-click menu in the structure pane simply had a "Properties..." entry or something similar that brought focus to the Property Inspector, it would help the user understand that there's another place to try to make the desired changes.

Maybe you are looking for

  • Message to Creative La

    Dear Creative Labs: As a once valued customer I now feel completely betrayed by your unlawful and unethical business pratices. While as a former Aureal user, I turned a blind eye chalking it up to Aureal being careless. However after reviewing your b

  • Issue to Add one new column in search Page..

    I have a JSP file of Service Form of Oracle Install Base . In this on select party Site page when search for any item it shows some result as a column. like address , name, country.. we have to add a new column in that search. means when we search fo

  • Macbook Pro 10.6.8   Beeps 3 times upon start up.

    My Macbook Pro (4 GB RAM) - is beeping LOUDLY 3 times when I start up.  It has been performing poorly lately.  It seems to have trouble coming out of sleep.  It will just become unresponsive and have to restart.  I took it to Apple and they kept it o

  • White Balance question

    I have taken a few zillion pictures of various minor hockey games. I have not been wise enough to use a WB card, so most of the pictures are various shades of yellow due to bad lighting in the arena. EVERY picture however requires me to use the dropp

  • Create Tabular Form On Non Tabular Data

    Hi, I'm not sure if this is possible. We have an existing process the project manager enters the users time again projects this i done row by row so the results are User Project Wk Hrs A 1 1 8 A 1 2 4 A 1 3 3 A 1 4 1 B 1 2 5 B 1 3 2 D 1 1 7 D 1 3 8 I