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

Similar Messages

  • 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

  • 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

  • Master-Details Record

    I have a Master and two details records. I need to generate report for the Master-Details record.
    I need to include some details from the Master table and some details from each of the detail tables.
    For example :
    In Master table: Employee_Number
    Employee_Name
    Company_Code
    Company_Name
    In Application Detail table: Application_Code
    Application_Name
    In Non-Application Details table: Non-Application_Code
    Non-Application_Name
    I need to include Employee_Name, Company_Name, Application_Name and Non-Application_Name in my report. How should I go about creating the report?and may I know what type of report style should I use?Should I use Tabular or Group Above?
    Thank for your help

    hello,
    you might want to start off with a regular master detail layout and then modify the layout manually to fit your needs.
    when running throught he wizard, you just select whichever fields you want to display.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Master-details records

    Hi Everybody,
    i have a requirement to show master detail records.to show data i have 3 tables
    they are 1) Flat_Master(flat_id,flat_desc,pic)
    2)Flat_Detail(flat_id,flat_face_id,flat_loc)
    3)face_tab(face_id,face_desc)
    in my jsf page i displayed flat_master as master records and flat_detail as detail records
    here flat_detail is updatable.so for flat_face_id i created a lov choice list based on face_tab table(ADF BC level).
    so when master record i changed, my choice list is not getting changed amd even when page load also for the first record also it is not selecting..
    How can i set this choice list value programatically based on master records?
    Any ideas can you please share with me?
    thanks
    KM.
    Edited by: Mr. Murali on Sep 13, 2011 3:21 AM

    pls provide me the detailed view.,
    what ur trying to say and wat s ur use case?

  • What is the proper way to record line numbers in Master/Detail records?

    Guys and Gals,
    Been thinking about this for awhile, but thought it best to ask the people who really know what they are doing.
    What is the proper way to record & show line numbers in a Master / Detail record set?
    For example, take Master/Detail relationship Orders and OrderItems. Orders has a column Document_Number and OrderItems has Document_Number, Line_Number. Line_Number should contain the row number 1,2,3,4 ... etc. for each row in a document.
    Should I ...
    <ol><li>Add a sequence and a trigger in the database? The FusionOrderDemo does this, but then the sequence never "resets" and I've got row numbers that keep incrementing. So one document has rows 4,5,6 and the next document has 7,8,9 when they should both have 1,2,3.</li>
    <li>Programmatically take care of the row numbers? This seems like I'm asking for trouble. Anytime an insert or delete operation gets done, I'll have to iterate through rows and re-assign row numbers.</li>
    <li>Is there a way to assign row numbers in a table iterator (or data collection?) to an entity?</li></ol>
    Any suggestions would be appreciated. It's looking like #2 is my only option, but if anyone knows different I'd love the input.
    Will

    Thank you both guys.
    As John said, I believe I'm looking for a gap-free sequence per master record.
    The line number of the OrderItems table is the second half of the primary key. The first half of the primary key (DocumentNumber) is the foreign key to the Orders table.
    Think of it like line items on an order or invoice. For example, if you were talking to someone on the phone concerning an invoice, you might say, "The pricing for line item #3 is incorrect." In this case, it's good to have a common reference. Or imagine a Microsoft Excel spreadsheet with no row numbers displayed! You'd never get anywhere if you had to explain something over the phone.
    If this is tricky to perform, I take it using a sequence and trigger such as the Fusion Order Demo is the best way to approach the challenge for simplicity's sake?
    Will

  • 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

  • Generate file with a master-detail records

    Hi everyone,
    I need your help, one more time.
    I want to generate a file in ODI that have two distincts records of the detail, a master-detail records. The first one record contain general data and second one contains a second level information about the previous.
    I got the result using a bad solution, loading the file line by line, but the file is so large and performace was very slow.
    The expected result is:
    001Purchase Order id 99
    002Item 1
    002Item 2
    001Purchase Order id 150
    002Item 1
    002Item 3
    001Purchase Order id 4870
    002Item 3
    Anyone has an alternative for that?
    regards.

    hello
    i belive you need to use pivot operator
    check out this blog
    https://blogs.oracle.com/warehousebuilder/entry/pivoting_data_in_owb
    rgds

  • 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

  • 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

  • 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

  • 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