Master Detail with programmatic ViewObjects and writeXML

Hi,
Using jdev 11.1.1.3.
I created two programmatic ViewObjects related by a ViewLink (1to*).
From an application module method, I create a row in the master ViewObject. Then using the accessor obtain the RowIterator for the detail, and create a row on that detail.
If then I use the writeXML method on the master ViewObject, the output is only representing the master, not the detail.
Here is the code:
        VO_MasterImpl voMaster = getVO_Master2();
        //create the master row
        VO_MasterRowImpl rowMaster = (VO_MasterRowImpl)voMaster.createRow();
        String id = "unique";
        rowMaster.setAtt1(id);
        rowMaster.setAtt2("something");
        //obtain the rowIterator for the detail
        RowIterator detail = rowMaster.getVO_Detail();
        //create the detail row
        VO_DetailRowImpl rowDetail = (VO_DetailRowImpl)detail.createRow();
        rowDetail.setAtt1(id);
        rowDetail.setAtt2("sth2");
        //insert the detail row
        detail.insertRow(rowDetail);
        //insert the master row
        voMaster.insertRow(rowMaster);
        //obtain the xml
        Node node = voMaster.writeXML(-1,XMLInterface.XML_OPT_ALL_ROWS);master.att1 is key for Master.
detail.att1 is foreign key to Master.
This is the contents of node:
<?xml version = '1.0' encoding = 'UTF-8'?>
<VO_Master><VO_MasterRow><Att1>unique</Att1><Att2>something</Att2></VO_MasterRow></VO_Master>What I would expect is that the detail row (<VO_DetailRow>) appears within the <VO_MasterRow>.
Anyone knows what I'm missing here?
Thanks
Roger B
Edited by: RogerB on 30-Dec-2010 02:16

Hi,
After some more tests...
As said before, I tried with SQL VOs (Dept and Employees). No differences between the VL Dept and Emp, and the VL VO_Master and VO_Detail. They have same relationship (1 to *) and also same (changing names) SQL where (source and destination).
I debuged the code, using ADF source code, and noticed the following:
When iterating the rows to write the XML, at ViewRowImpl, it takes the AttributeDef and perform different actions depending on mKind (ATTR_ASSOCIATED_ROW or ATTR_ASSOCIATED_ROWITERATOR). Second one is for ViewLink.
Once inside ATTR_ASSOCIATED_ROWITERATOR, I can see that the default RowSetIterator, has no rows (getRowCount = 0). So no child rows (for the VO_Detail), are added to the XML Node.
On the other hand, the Dept and Employees, I can see that the default RowSetIterator has rows.
Could this be related to the fact that Programatic ViewObjects are not persisted anywhere?
any other clues appreciated? Does anyone tried this before (programatic master detail relationship writing to XML) ?
Regards,
Roger

Similar Messages

  • PRISM Master-Details with navigation between the Master and details view

    Hi, I have a Master list with accounts and a Details list containing transactions.
    The Master list : has a UserControl (AccountListView) and Viewmodel(AccountListViewModel)
    The list is bound to an observable collection of type AccountViewModel and has a SelectedAccount property to get the current selected account. Each AccountViewModel has a collection of type TransactionViewModel.
     public AccountListView(IAccountListViewModel viewModel)
                //this.DataContext = vm;
                InitializeComponent();
                ViewModel = viewModel;
            public Infrastructure.IViewModel ViewModel
                get
                    return (IAccountListViewModel)DataContext;
                set
                    DataContext = value;
    //the viewmodel
            public AccountListViewModel(IRegionManager regionManager)
                this.regionManager = regionManager;
                this.AccountList = GetAccounts(); // gets the list of accounts from another layer
            public AccountViewModel SelectedAccount
                get { return selectedAccount; }
                set
                    selectedAccount = value;
                    OnPropertyChanged("SelectedAccount");
    And the Details view has a user control(TransactionListView) and a viewmodel(AccountView);
    public TransactionListView(IAccountViewModel viewModel)
                InitializeComponent();
                ViewModel = viewModel;
                //this.DataContext = vm.SelectedAccount;
            public Infrastructure.IViewModel ViewModel
                get
                   return (IAccountViewModel)DataContext;
                set
                    DataContext = value;
    //the viewmodel 
    public AccountViewModel(Business.Account a)
                    AccountId = a.AccountId;
                    accountName = a.AccountName;
    I created a hyperlink command so that whenever I click on the name of an account from the master list it will navigate to the detail list and set the as the DataContext the account I clicked on. Before I had both Master and Detail lists displayed at the
    same time and set the DataContext of the Detail List as the SelectedAccount property(which is bound to the SelectedItem of the Master List) of the Master List. I am not sure how to pass the SelectedAccount when I navigate to the Detail List and set it as the
    DataContext of the Detail List.
           

    >>I'm using the reguestnavigate method, but from what I read you can't pass objects as parameters ?
    As I mentioned there is a NavigationParameters class that you can create an instance of and pass as a parameter to the RequestNavigate method in Prism 5:
    private void NavigateTransaction(AccountViewModel obj)
    var parameters = new NavigationParameters();
    parameters.Add("accountViewModel", obj);
    regionManager.RequestNavigate(RegionNames.ContentRegion, new Uri(transactionview, UriKind.Relative), parameters);
    The TransactionView should then implement the Microsoft.Practices.Prism.Regions.INavigationAware interface and retrieve the parameter in the OnNavigatedTo method:
    public partial class TransactionView : UserControl, INavigationAware
    public TransactionView()
    InitializeComponent();
    void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
    AccountViewModel myParameter = navigationContext.Parameters["accountViewModel"] as AccountViewModel;
    this.DataContext = myParameter;
    public bool IsNavigationTarget(NavigationContext navigationContext)
    return true;
    public void OnNavigatedFrom(NavigationContext navigationContext)
    In Prism 4 there is no NavigationParameters class so you either need to upgrade to Prism 5 if you haven't already done so or you could store the parameters to be passed yourself somewhere else. Please refer to the following links for more information and
    examples of how you could do this:
    http://stackoverflow.com/questions/9320638/how-to-pass-an-object-when-navigating-to-a-new-view-in-prism
    http://visualstudiomagazine.com/articles/2012/08/20/view-communication-in-wpf-and-prism.aspx
    Please also remember to mark helpful posts as answer to close the thread and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • Master-detail with dynamic view object

    How can you create a view link with a view object that is dynamic? I have created a master-detail relationship on a UIX page. I change the master view object at runtime using a view definition and SQL and then I bind the view object to an iterator on a UIX page. I need the new dynamic view object to maintain the link between the detail view object. Is this possible?
    The reason why I have to change the view object at runtime is because I am implementing a search module and the tables in the from clause can be modified at runtime so I need to have a dynamic view object.
    Thanks,
    Sanjay

    After playing around with ViewObjectImpl's setQuery() method some more I found out that this solution might not work for me due to the following reason: when the user tries to sort a column in the result table, the original contents of the view object get executed instead of the run time query.
    <p>
    I would like to go back to my original solution that included creating a view definition based on the runtime query and then creating a view object from that which I bind to the RowSetIterator. The missing piece to the master-detail functionality is with the detail Iterator being in sync with the master. I have tried the following but I get a ClassCastException <p>
    DCIteratorBinding detailBinding = ctx.getBindingContainer().findIteratorBinding("DetailIterator");
    detailBinding.getViewObject().<b>setMasterRowSetIterator</b>(masterBinding.getRowSetIterator());
    <p>
    here is the relevant stack trace:
    java.lang.ClassCastException
    at oracle.jbo.client.remote.ViewUsageImpl.getImplObject(ViewUsageImpl.java:1829)
    at oracle.jbo.client.remote.RowSetImpl.setMasterRowSetIterator(RowSetImpl.java:512)
    at oracle.jbo.client.remote.ViewUsageImpl.setMasterRowSetIterator(ViewUsageImpl.java:1147)
    at oracle.jbo.common.ws.WSViewObjectImpl.setMasterRowSetIterator(WSViewObjectImpl.java:1005)

  • Master Detail with Search

    Hi All,
    I have created a Master (Form with Navigation buttons) - Detail (table) with search region.
    Intially both regions show no data as expected.
    When I search for an entry in Master region - It shows the data in Master but not in Details region.
    When I click Next in the Master then I can see details in the Table.
    Now if I click Prev in the Master I can see the details in the Table.
    If I tried to search for new data , Master form gets refreshed but details table will not get refreshed till I click on navigation buttons.
    (I think details is getting refreshed on Navigation button Events)
    If I don't have any search region.. Both Master and Details get initial load works fine.
    I tried creating Master(table)/ Detail(table) with search region on top of them.
    No data resulted.. :( after querying the data. (As there are no navigation none of the tables get refreshed).
    Pl. let me how to get the details get data based on Master.
    Thanks,
    Satya

    Shay,
    I did set the page Refresh between two areas.
    It works fine if I click on Navigation button Next, Prev.
    This happens only if I have Search bean on top to search master.
    Thanks,
    Satya

  • Master Details with ADFBC Listbox

    Hi Everyone,
    I'm trying to setup master - detail page with ADF BC, using Dept / Emp.
    I want to use a listbox for the master object, rather than the form + navigation commands as shown in the classic demos, so I've setup a listbox as following:
    <af:selectOneListbox value="#{bindings.DepartmentsView1.inputValue}"
    label="Available Flows:"
    id="listbox_depts">
    <f:selectItems value="#{bindings.DepartmentsView1.items}"
    id="id_Selcet_Items"/>
    The details element is the classic read-only table created by dragging the Employees view (under the departments) into the page.
    The problem arises when I run the page - the list box shows all the departments, but when I click on different departments the table data does NOT change (as it would when navigating between rows with the classical form navigation buttons).
    I've set up the Table's partial triggers to both of the listbox ids: id_Selcet_Items and listbox_depts but this doesn't help.
    Is this a bug, or am I doing something totally wrong?
    Tal.

    This looks like a good question for the JDev 11g TP3 forum.
    -h.

  • Master/details with render false on details when no rows doesn't work fine

    I created a standard master/details (form/form) based on Dept and Emp tables.
    This work as expected.
    Then i changed the rendered property of the details table by setting the following EL #{bindings.DeptView1EmpView2.estimatedRowCount>0}
    because i do not want details table to appear when there are no rows
    Here is how things go
    1) navigate to deptno 10, you see the employees of dept 10 correctly, the same applies to 20, and 30, but when you select dept 40, things start acting kind of wierd
    the details table does not disappear as expected
    returning back to dept 10, or 20 etc does not also render the details it freezes, keep navigating between 10,20,30 and randomly, the screen refershes correctly, until you again hit an master with empty details.
    If you select a master with empty details and use the submit buttom, the details table disappears as it should, if you try other master rows, the details remain hidden until you submit the page manually
    any ideas
    regards
    Ammar Sajdi

    hello again
    i removed PPT and the autosubmit that are created by default, and replaced them with JavaScript Submit() operation linked to the master table row selector. Now it works, but really i still do not know the negative implications of this work around. I feel it is not a good idea, since ADF designer favoured using the PPR method
    Ammar

  • Master-detail with auto-generated primary key(master)

    Hello,
    I have the following master-detail setup:
    Master - block A primary key is: codeA
    Detail - block B
    codeA is genrated only at commit time and is obtained from a sequence.
    User needs to add detail records. This is easy to do since he has to click on the insert icon on the toolbar. At commit time, use commit_form.
    Prob: the requirements as asked by the client is to add a button (which we will label INSERT DETAIL). When the user click on the button, it opens a window where he can enter the detail info then click on save. This should bring him back to the master-detail form and the record in the detail block is inserted.
    What is the problem here ? since the detail block has the foreign key tied to the master primary key, the window-form (with the call_form) that we opened for the detail entry won't be able to save since at this point we still have not assigned a value for the primary key (and hence a value for the foreign key).
    Possible Suggestions:
    -Use a temp database table to hold the detail record from the second form and use it to transfer values to the detail record in the master-detail
    -Use a global record group
    -We can't use parameter list to pass back these values.
    So my question is:
    What would be the most efficient way to have an insert button on the detail block that would allow the user to have a pop up where he can insert his values and then be brought back to the master-detail.
    Thanks.

    Hello again,
    May be I was not clear enough.
    Scenario 1: We use the master-detail form as is with the default oolbar. In this case, the user can insert the detail records one by one without needing the primary-foreign key value since this is handled by default.
    Once we save the form (commit_form), I use the pre-insert trigger to get the master block primary key generated from the sequence and since the detail block key is copied from this value, both are saved correctly and it is the end of the story.
    Scenario 2: As explained in the initial post, the user will populate the detail records one by one by clicking on the -INSERT DETAIL- button and hence has a window where he can insert the detail info and then be brought back to the master-detail form every time he enters a new detail record.
    The problem here is that I can't generate the primary key for the master block since the client has the following requirement:
    The user can always change his mind and not complete, meaning save the form, his process
    As such, the key should be generated in the last step before Commit.

  • Please Help, Data Set Master/Detail with mySQL DB

    Hi...
    I installed the Data Set Master/Detail Sample (states and
    citys autopopulate) getting values from a XML file...
    when a user adds a listing in my site, it works great.. i use
    the XML file values for the states/citys and then everything is
    stored in a DB... BUT i need to do this..
    when he comes back to edit his listing, i want the Data Set
    Master/Detail to show hes values (from de DB) with the option to
    edit them, not the first XML file values.
    Thanks

    Thank you kinblas!!!!!
    I saw another post with the solution!!!
    Here it is
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1308016&highlight_key=y&keyword1=SetDefaultState
    Thanks again!

  • Master/Detail/Lookup functionality - ApEx and AJAX vs Oracle Forms

    I'd like to build a master detail form with some lookup functionality and have some of the fields automatically populated. I come from an Oracle Forms and PL/SQL background so I was hoping for some guidance in ApEx and Javascript for how to achieve the same effect.
    If you look at the default Sample Application (DEMO_APP), page 29 has the master record and the corresponding details on the same page.
    The functionality I'd like is:
    1) when a new product is chosen from the Product Name select list, I'd like the Unit Price to be populated.
    2) when the Quantity is updated, I'd like
    a) the Extended Price to be recalculated and
    b) the Order Total to be recalculated
    all before submitting the page. This is pretty trivial in Oracle Forms but I've had limited success with ApEx.
    I've been able to achieve 1) in a single record form but not a tabular form using the techniques from Scott's AJAX generator http://htmldb.oracle.com/pls/otn/f?p=33867:2.
    I've been able to achieve 2a) in a tabular form using the techniques from Vikas in this thread Tabular form with Ajax
    I haven't had any luck getting 2b) to work.
    So, is my wish list possible?
    If it is, I'd appreciate some pointers and/or code. I don't speak Javascript but I can copy and paste ;)
    Cheers,
    Bryan.

    Hi Carl,
    Ok, thanks for the tip - take a look at http://htmldb.oracle.com/pls/otn/f?p=24745 login as demo/demo and edit one of the top orders. This will take you to page 29.
    I've changed the 2.0 Sample Application to allow both the unit_price and the quantity to be overtyped. Each column has the 'Element Attributes' property set to onChange="calcTotal(this)" to call the javascript code.
    This recalculates the extended_price (feature 2a above) but the order total (or the report total) is not affected (feature 2b) - how can I change the code to achieve this?
    If I change an existing line item and choose another product from the select list, I'd like the unit_price and the extended_price to change appropriately (feature 1 above) - having to wait until after the form is submitted is not acceptable to my users.
    Thanks for taking the time to look at this - I really appreciate it.
    Cheers,
    Bryan.

  • Problem with apply changes on master-detail with respect to date handling

    dear sir,
    i have one tabler where in i have created from_Date and to_date as varchar2(30) each. I stored the from date as 'dd-mon-yyyy hh24:mi' I had written before header process for calculating no of days between from_Date and to_Date using the said format. If to_Date is null then first i store the value as
    to_char(sysdate,'dd-mon-yyyy hh24:mi') and then convert it as to_Date(substr(to_Date,1,17),'dd-mon-yyyy hh24:mi'). this calculation of days procedures works fine in sql command mode.
    when i am handling through master-detail page i works fine when there is null value inf to_Date vc2 column. if i store using date picker dd-mon-yyyy hh24:mi, the data is getting stored but subsequent edit through master detail give error as ora-01722 unable to fetch row. Manually if i set the to_Date as null pages works fine. I spent lots of time and unable to understand the mistake i do.
    if anybody could help me, i will be much obliged.
    thanking you,
    yours
    dr.s.raghunatha

    I think the best would be if you create an example on apex.oracle.com and I will debug it.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Having multiple level of master/detail with data tags

    Hi,
    Here is a Database Model for the purpose :
    - An EMPLOYEE is in one and only one DEPT
    - a DEPT has several EMPLOYEEs
    Suppose that:
    - An EMPLOYEE come from one and only one SCHOOL which is in a SCHOOL table
    - a SCHOOL have educated several EMPLOYEEs
    Suppose that:
    - A SCHOOL is part of one and only one SCHOOL_CATEGORY (Engineer school for example)
    - A SCHOOL_CATEGORY concerns several SCHOOL
    I would like to show a JSP page containing :
    Employees for DEpt : 12456
    table headers:
    Employee ID | Employee Name | School Name | School Category Name
    as you can see we have a master/detail between Master view DEPT and Detail view EMPLOYEE and EMPLOYEE is master for School which is detail view for employee and school category is detail view for school which is master for school category ! (do you follow me ? ;-))
    Do you see my concerns ??
    How do we do that whith data tags ??
    Thank's a lot for you help...
    It's urgent...

    Hi,
    I guess you are trying to achieve this using BC4J if so then you can modify your view object for employee so as to have School and category listed when you base your datatags on that view.
    You would need to modify your view object query by using expert mode.
    Thanks
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Olivier LAHILLE ([email protected]):
    Hi,
    Here is a Database Model for the purpose :
    - An EMPLOYEE is in one and only one DEPT
    - a DEPT has several EMPLOYEEs
    Suppose that:
    - An EMPLOYEE come from one and only one SCHOOL which is in a SCHOOL table
    - a SCHOOL have educated several EMPLOYEEs
    Suppose that:
    - A SCHOOL is part of one and only one SCHOOL_CATEGORY (Engineer school for example)
    - A SCHOOL_CATEGORY concerns several SCHOOL
    I would like to show a JSP page containing :
    Employees for DEpt : 12456
    table headers:
    Employee ID | Employee Name | School Name | School Category Name
    as you can see we have a master/detail between Master view DEPT and Detail view EMPLOYEE and EMPLOYEE is master for School which is detail view for employee and school category is detail view for school which is master for school category ! (do you follow me ? ;-))
    Do you see my concerns ??
    How do we do that whith data tags ??
    Thank's a lot for you help...
    It's urgent...<HR></BLOCKQUOTE>
    null

  • Multiple level of Master Detail with ShowOneTab

    I am developing an ADF application using JDeveloper.
    Let us assume that we have three entities A,B and C. I have created three view objects and two View Link objects to implement three level Master-Detail relationship.
    I have created master table - detail table on a jspx page where master is entity A and detail is entity B. Detail table is in a showDetailItem component in showOneTab which works fine.
    Now I have the requirement to create another level of master detail hierarchy between entity B and C. The master of this relationship is B, which is displayed on one showDetailItem tab as stated above. While the detail for entity C must display on second tab (showDetailItem).
    I have set the partial trigger id of third table to masterDetail2 (id of the entity B table now serving as master). I have also set the AutoSubmit property of this table to true. But the data is not refreshed, it always displays the first set of records.
    Please suggest what I can do or if I am missing something to implement the solution?
    Regards,
    Amir

    Hi,
    I think this is because PPR doesn't work on hidden components (that are components that are not rendered). Try and add a listener to the tab canvas that then on changing the tabs, re-executes the iterator for this table
    Frank

  • Master detail with from clause query

    Hi!
    I have 2 blocks: master and detail. The master block is based on a from clause query. Since I have to insert, update and delete on this block I have created the on-insert, on-update, on-delete and on-lock triggers (and the respective procedures).
    In this block I have on-populate-details and pre-delete triggers created by the master-detail relation.
    Now I have a problem!
    Since I only want to commit to db when I click the "ok" button and I want to insert and delete records from these 2 blocks, when I insert records into the detail block (and master too), it forces me to save changes if I change the focus of the current record of de master block to another record within the same block.
    How can I do this in order to insert records saving changes only when I click the button?
    Thanks!
    Ana

    I think that it is intended behaviour: when detail records are populated and there are uncommited changes so Forms asks if user wants to save changes.

  • Using viewlink with programmatic viewobject

    Hi!
    I am using two programmatically filled view objects, hence without underlying queries or database objects.
    I want to link these two objects together using a view link, because I want to display data on a JSF page using a tree control. The objects have an attribute on which the link can be made.
    I do not seem to get the detail view object to work right and return information.
    How can this be implemented? Any idea on what methods I should override in the viewobject implementation?
    Jeroen van Veldhuizen

    Hi,
    I have solved the problem.It was because of the way I had defined the VL.I had configured it this way :
    CustomerView
    |
    --- SalesOrderView Via CustOrdVL
    SalesOrderView
    |
    --- ItemView Via OrdItemVL
    (CustOrdVL joins CustomerView and SalesOrderView on CustomerID.OrdItemVL joins SalesOrderView and ItemView on OrderID)
    It should have been :
    CustomerView
    |
    --- SalesOrderView Via CustOrdVL
    |
    --- ItemView Via OrdItemVL
    Then, it works fine.
    Thanks,
    Sandeep

  • Vendor Master details with email address

    Dear sir,
    How to get the list with all the vendor with address, contact nos. and email ids.
    pls let me know the T code for the same.
    devesh

    Hi,
    Using T-code MKVZ - List of Vendors : Purchasing, give input data purchasing organization, Account Group and execute the report display all vendor details which is already stored in data base and report top line click Change Layout button(blue color) it will open new window right side required data field selected and click <--- mark selected field come to left side and then press tick mark. now the report shown vendor related all data's are displayed.
    Hope, it is useful for you.
    Regards,
    K.Rajendran

Maybe you are looking for

  • Color Management Problem

    I just installed Photoshop CS3 on my home PC, and seem to be having a problem with color management. When opening photos taken with my Canon G9, or even pictures downloaded off the web, in Photoshop they appear badly posterized. Viewing the same phot

  • Remote ftp access

    I cannot get remote ftp access to my NMH405. I have remote access through https://ciscomediahub.com/ and can browse through my files this way, but I need to have remote access through ftp as well. I have set ut ftp access and it is working locally on

  • Need a help in pl/sql cursors

    Hi, wrong posted...if i have any clarifications i can mail to all. thanks...

  • Error after "at new " event

    Hi , I have an internal table with header line named t_rec which has three fields pitem , plant , citem. I have sorted this internal table by statement sort t_rec by pitem plant citem. I'm then looping at this internal table , i also have following e

  • Mac Mail Freezes when attaching files

    Ever since my upgrade to snow leopard, my mac mail does 2 things. 1, it keeps asking for my name and password, and I have already cleared out my keychain, re input all my information, and it keeps doing that. does it about once a day. but my more det