Creating master detail rows

using adf/bc with jsf. I have defined a master detail relationship between two entities. This relationship is a composition relationship. The entities are related by a view link which link the master and detail view objects. i have a need to create/insert a master row and a detail row programmatically "on the fly" so that when the jsp renders, the user will see blank inputs for both the master and detail view objects. The problem is that the primary key of the master record is not known at creation time ( it will be entered by the user) and therefore the detail record cannot be created by the framework because of the unknown value of the parent's primary key. I was hoping the following section in the adf guide would eliminate my problem, but it doesn't appear to:
This is from section 26.7.3.2 of the adf developer's guide
Note: An alternative to the programmatic technique discussed
above, which solves the problem at the J2EE application layer, is the
use of deferrable constraints at the database layer. If you have control
over your database schema, consider defining (or altering) your
foreign key constraints to be DEFERRABLE INITIALLY DEFERRED.
This causes the database to defer checking the constraint until
transaction commit time. This allows the application to perform DML
operations in any order provided that by COMMIT time all appropriate
related rows have been saved and would alleviate the parent/child
ordering described above. However, you would still need to write the
code described in the following sections to cascade-update the foreign
key values if the parent’s primary key is assigned from a sequence.
This approach did not help in allowing me to create the detail record without first knowing the value of the parent's primary key record in a composition relationship. The only thing i've found to work is define the relationship as just an association, and not a composition. However, this is a true one to many (composition) relationship and i would like to take advantage of some of the features of the framework that are there when a relationship is defined as a composition relationship. Is there any way to do what i need to do with a composition relationship defined between these two entities? Thanks.

Hi,
I guess you need a "Cascading LOVs".
1) Create viewObject for country values list. Named VO1.
2) Create viewObject for state values list. Named VO2.
3) Create view criteria for (bind variable) VO2 which can restrict the result by country.
4) Create view accessor to get VO1.
5) Create view accessor to get VO2. Define the bind variable value which can provide country info dynamically. I guess it should be a Groovy expression.
6) Create country LOV on step 4) view accessor.
7) Create state LOV on step 5) view accessor.
Done
On the view layer, you may enable PPR between country and state attributes.
Todd

Similar Messages

  • Creating master-detail VO in custom AppModule method

    Hi.
    I need to create master-detail view objects and save them in DB in my custom AppModule Service Interface method.
    I have the next master-detail view objects:
    RegistryVO (1) -- (*) RegistryItemVO
    Also I have a view link for this relationship.
    I wrote custom method with next signature:
    Integer createRegistry(RegistryVORowImpl registry) {
    Then, I added this method to my AppModule Service Interface.
    Method works fine, but only master row is created and inserted to DB (only Registry but not RegistryItem). I.e. when I testing this method in EM I fill full RegistryVO with nested RegistryItemVO data but in my method RegistryVO comes without nested RegistryItemVOs.
    Then, I added SERVICE_PROCESS_CHILDREN custom property to view link (RegistryVO-RegistryItemVO) as it described in chapter 11.2.5 of Fusion Developer 's Guide for Oracle Application Development.
    After that nested RegisttryVO in my method contains nested RegistryItemVOs.
    In my custom method i need to set primary key for RegistryVO. So I set it in registryVO to PK attribute and set it in nested registryItems to FK attribute.
    But when I doing commit I have an exception:
    Exception while executing the business logic: JBO-26048: Constraint "PP_PST_RG_IT_PP_PST_FK" is violated during post operation "Insert" using SQL stat
    ement " *INSERT INTO PP_PERSON_ST_RG_ITEM* (PP_PERSON_ST_RG_ITEM_ID,IN_DOCUMENT_ID,POL,FULLNAME,NAME,FULLOT,TIN,D_ROG_DT,D_REEST
    _DT,PROCESSING_DT,PROCESSING_STATE_CD,RECEIVE_YEAR) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12)".: ORA-02291: integrity
    constraint (PP_PST_RG_IT_PP_PST_FK) violated - parent key not found
    It seems that only registryItems are commited in DB. I'm not seeing INSERT for Registry in ServieInterface log...
    But if I setting primary key for RegistryVO when I invoking method (if I setting id for registry in test console of EM, not in method) - it's work fine .
    What I'm doing wrong ?
    How can I create custom method for AppModule Service Interface to create master-detail view objects and set PK for master and FK for details within method ?
    Edited by: user2975420 on 19.10.2010 4:46
    Edited by: user2975420 on 19.10.2010 4:49

    Thanks for reply, John.
    I have already added master and detail view objects usages to my AppModule Data Model. And yes, I add detail VO as child of master.
    It seems that the reason of my problem is another...
    I can't create master/detail when I'm setting id of master in custom method. If I set id of master in input parameter (RegisterVORowImpl) then method invokes successfull.
    I noted one moment - if I'm not setting SERVICE_PROCESS_CHILDREN custom property for view link, I can set id of master VO inside method. But in this case my master VO haven't got nested RegisterItemVOs.
    Edited by: user2975420 on 19.10.2010 10:23
    Edited by: user2975420 on 20.10.2010 1:31

  • Foreign key validation while creating master/detail record in document mode

    I am creating master/detail records in the document mode. And I am generating the master primary key in the create() method of the master Entity Object. Now I valdate the foreign key in the detail Entity Object's validateEntity() method by doing a query to the master table through some View Object.
    But since the master record has not yet been posted (since it hasn't been committed) to the database, this query does not return any record and the validation fails in detail object.
    And thus the create fails.
    Please let me know if this is the right approach for doing this. If so where I am going wrong? Else please let me know if there are any better approach to do this.
    Kunal

    Kunal:
    Use a code snippet like the following:
    --- Assuming you're in the detail EO's create method ---
    oracle.jbo.server.EntityDefImpl eDef = oracle.jbo.server.EntityDefImpl.findDefObject(<package-qualified-name-of-the-master-Entity-Object>);
    oracle.jbo.Row masterRow = eDef.findByPrimaryKey(this.getDBTransaction(), <foreign-key>);
    If the row does not exist, masterRow will be null.
    findByPrimaryKey first checks the entity cache (which will include your new master row(s)) and then go out to database (if it's not in cache).
    Thanks.
    Sung

  • Having problem with creating Master Detail form , please help

    I have to work on a project to create a survey system using APEX, as am new on using this tool , am still facing some problems to finish my job..
    i created Master/Detail form using wizard, the master form is working fine but am when i try to add data using the detail form its giving me error :
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "A884FA378C851786DDFE3A33709CB23C", item checksum = "5F8B1EE5CD3D46437455F43B37B9A6A0"., update "ABA"."ABA_SURVEY_SUBCATEGORY_MAST" set "ASCM_CATEGORY_ID" = :b1, "ASM_SURVEY_CODE" = :b2, "ASSM_SUBCATEGORY_ID" = :b3, "ASSM_SUBCATEGORY_DESC" = :b4
    i tried to go through the posts from others but i still dunno what is this error !!!& how to solve it..
    my master data table have 2 primary keys.. the details data table have 3 primary key all of them using trigger to fire a sequence to get the next_val!!
    am desperate & need help urgently for this ASAP.

    hello
    here is the solution,i hope this might help u.
    go to the code of your button and change write the following
    go_block('name of your master block');
    execute_query(no_validate);
    and in the object navigator make the first item in the master
    block that it should be displayed in the canvas and it must be a
    navigable item too.not a display item.
    thank you
    Zeeshan Ahmad

  • Error creating Master/Detail Form

    Hi,
    I tried to create a master detail form. I went through all the steps fine, only when i click the button to create the form, i received the following errors:
    ORA-20001: Unable to create master detail page. ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Unable to create Master Detail pages.
    Could someone please tell me what's wrong?
    Thanks,
    Patrick.

    We are getting this message in several areas in the development environmnet. It's happening in the developer login screen, when creating new tabs, and when tryig to create master detail reports. Here is our error from the Apache Log:
    [Mon Mar  2 11:41:31 2009] [error] [client 10.64.8.231] [ecid: 1236012090:148.94.143.136:24226:0:1621,0] mod_plsql: /pls/apex_qmnt/wwv_flow.accept HTTP-404 ORA-06502: PL/SQL: numeric or value error\nORA-06512: at line 31\n
    I think this is different from the issue above as that is due to too many items in a shuttle list. Ours seems to be related to our new APEX insstallation. Any help is appreciated here.

  • Trying to create Master - Detail form, getting  ORA-06502: PL/SQL: numeric

    Anyone know why we might get this error trying to create a Master Detail form in HTMLDB 2.0?
    ORA-20001: Unable to create master detail page. ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Unable to create Master Detail pages.
    Return to application.

    Please create the failing case in your workspace on apex.oracle.com and tell us the workspace name, app ID and steps to recreate.
    Scott

  • Unable to create master detail report

    Hi,
    I´ve two tables (Organisation and Purchases) and want to create a master-deatil with the wizard.
    At the end an error occurs:
    ORA-20001: Unable to create master detail page. ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Unable to create Master Detail pages.
    Return to application.
    Any ideas ? Any reaction will be appreciated
    Leo

    Leo,
    How are your two tables related? Do you have a foreign key constraint? It sounds like that there may be a datatype mismatch between the master table's PK and the detail table's FK - check to make sure that they are both NUMBER.
    Thanks,
    - Scott -

  • How to Create Master-Detail OA Page

    Hi,
    I'm trying to create Master - Detail Page in OAF, but i can't find right way to do that.
    Can anyone please explain me in steps how to create or give me any document/web link for reference.
    Thanks,
    SAN

    Hi
    chk below links
    http://oracle.anilpassi.com/master-detail-screen-in-oa-framework-part-i-2.html
    http://oraclearea51.com/blog/master-detail-page-in-oa-framework.html
    Thanks
    Pratap

  • How can I create master detail reprot output

    Hi to all!
    I have one question about creating master-detail report.
    My report must show asset's and depreciation and all other information for that asset. I can have one asset at two or more locations, cost numbers, ...
    Now I have 2 SQL's in my XML file. Q1 is master data for some asset and Q2 is detail for that asset, if I run my report with all parameters (book type, asset nubmer, cost nubmer) then it runs OK (I get master-detail report, for each asset I get separate page, even if asset has multiple cost number or locations), but if I run that report without cost number parameter I get multiple pages for master (data from Q1 on each page), but detail data is all together on each page.
    Can you help me how can I also get separate detail data in that case?
    I hope we understand each other!
    Regards,
    drama9346

    Hi Mustafa,
    Thanks for ur response.
    Actually, In my first tab page I have some details of employ which is based on a database table.
    The second tab page also contain the details of employ which based on backend stored procedure. I used a REF cursor in that stored procedure.
    When I have created a master detail relationship based on employee_id, it created the relationship but while executing the form it is giving error like
    'pk_empdetails.query' must be declared.
    pk_empdetails.query(is backend procedure).
    Hope u got my point.
    Regards
    sonali
    null

  • Creating a master automatically when creating a detail row

    Hi,
    I'm using Jdev. 11.1.2.3.0
    I have three tables (with their corresponding view objects) with a master/detail/detail relationship.
    The first-level detail table contain a maximum of one row for each master row.
    The ids of the first-level and second-level details are automatically generated with a groovy expression and a sequence.
    The views are added on the page as table(master/)form(detail)/table(detail).
    I have a case where a master record has no details and i need to create a row in the second-level detail table.
    So is there a way to tell ADF to automatically create the first-level detail row (since the master is known) ? or i should manually check that such a row doesn't exists in the first-level detail table and thus create it before creating the row in the second-level detail table?
    Thank you.

    So is there a way to tell ADF to automatically create the first-level detail row (since the master is known) ? or i should manually check that such a row doesn't exists in the first-level detail table and thus create it before creating the row in the second-level detail table?
    Thank you.
    No, there is no such option so you will need to manually create this row.
    Dario

  • Master-Detail in One Page, on CREATE master, details show wrong rows

    Hi all,
    (ADF Faces + BC, 10.1.3 su5)
    I am creating a master-detail add/edit page in ONE page.
    Master : ADF Form, with Create, Submit, Commit, Rollback operation/button
    Detail : ADF Editable Table, with Create, Submit, Delete operation / button
    When first called, the page display the existing master-details in the collection.
    When I press Create on master, I expect the detail table to be refreshed to BLANK, but it keeps on displaying the existing rows.
    Detail table only becomes BLANK after I Submit the newly created master first.
    So the question is :
    How to make the detail table BLANK after I press Create on master ?
    Thank you ,
    xtanto

    See section 10.4.3 "When to Use CreateInsert Instead of Create" in the ADF Developer's Guide for Forms/4GL Developers.

  • Create Master Detail on a single page

    I have a create page with both the master(header) as well as (lines) on the same page.
    Here is the page flow:
    User navigates to the search screen on which the create button is displayed along with Search/Results regions.
    User clicks on create button which takes them to Create Order Page.
    The Create Order Page is a master-detail page. I have the create part for the header (which was tested independently before
    the details table region is added) working fine which fetches and assigns the headerId from a sequence.
    However, when I add the details table region and include the create Row method for the details Row as well , without explicitly
    setting the headerId myself and render the page, I get the following exception. This exception is raised as soon as the control reaches the createRow
    method of the detail.
    This is probably due to the HeaderId being not yet available. How do I get around this issue.
    I was initially thinking of setting the attribute myself but the documentation says that when an Composition association
    exists between the Entity Objects, OA automatically does it for you.
    I included the detailVO in the AM via the view link.
    Exception
    oracle.apps.fnd.framework.OAException: oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity.
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:862)
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:985)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:210)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:692)
         at nih.oracle.apps.po.webui.NihPoStOrdCreateCO.processRequest(NihPoStOrdCreateCO.java:65)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:518)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:244)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:920)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1536)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:866)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:833)

    After creating your master entity row, use setCurrentRow(<newly created row obj.>)

  • Create New Detail Rows

    I have a jsp page with Master-detail tables. My current create new row button has to set current on one detail row to be able to create a new row. I have some master rows have no detail items. So my create new row button won't show up.How can I create a new detail row without setting a current. Thanks!

    I current have a create button goes with each detail row as href="browseMD.do?event=setCurrentRowWithKey&Arg0=<c:out value='${Row.rowKeyStr}' />&event=Create"
    I tried to drag 'Create' from the datail table DataControl->Operation->Create, but it won't work if I don't setCurrentRowWithKey.
    When I have only one table, I can 'Create' without setting current row on a view object. But the master and details seems to act differently, I couldn't make it work. Have you done any create new row with a master-datail view object?
    I'll try to work around with your 'dummy' row suggestion. Thanks!

  • Using EJB creating Master/Detail Record

    Hi All
    I would really in need of your help regarding how to show the information of master detail records in a single form
    eg: one text field with department Id and a Search button which should give relevent employees details working in that particular department.
    I tried with ADF business components it works fine..
    I need to do through pure Session Beans and Entity Beans(note : not thru using EJB:UseBean Tag)
    Please i will really appreciate your valuable help..
    Thanks All
    Have a Nice day
    Mohamed Anez

    Kunal:
    Use a code snippet like the following:
    --- Assuming you're in the detail EO's create method ---
    oracle.jbo.server.EntityDefImpl eDef = oracle.jbo.server.EntityDefImpl.findDefObject(<package-qualified-name-of-the-master-Entity-Object>);
    oracle.jbo.Row masterRow = eDef.findByPrimaryKey(this.getDBTransaction(), <foreign-key>);
    If the row does not exist, masterRow will be null.
    findByPrimaryKey first checks the entity cache (which will include your new master row(s)) and then go out to database (if it's not in cache).
    Thanks.
    Sung

  • Using layout wizard to create master details form

    I was using the layout wizard to create a master details form but for the details portion of the form, only one row of data was displayed. What needs to be done to have multiple rows displayed for the details portion of the master details form? I'm using Forms 9i.

    specify the number of records to display in either the layout wizard or in the block properties.

Maybe you are looking for