11 Replies Latest reply: Mar 25, 2010 9:09 AM by 680132 RSS

    Problem creating a row in a table that has two composition associations.

    680132
      Hi all,
      I am using Jdeveloper 11.1.1.2 and ADFBC.
      I have tableA (IdA, Attribute1), tableB (IdB, Attribute2) and tableC (IdC, refIdTableA,refIdTableB,attribute).
      refIdTableA and refIdTableA are two foreign keys and there is a composition association between tableA and tableC, and there is a composition association between tableB and tableC.

      In myPage.jspx I have a panelTabbed with two tabs: in the first tab I have TableA, in the second tab I have TableC. This two tables are in master-detail.
      When I try to create a row in tableC I have this error:
      JBO-25030: Failed to find or invalidate owning entity.

      How can I solve this problem?

      To solve this problem I have tried this:
      - I have replaced the createInsert button with a createWithParamsButton
      - I have definded an attributeValue in the pageDef that links to the value idA
      - I have inserted inside the createWithParams a NamedData that has property NDValue = #{bindings.IdA.inputValue}

      But when I press the createWithParams button I have this error:
      Failed to find or invalidate owning entity: entity details tableCEO, row key null.

      Thank you.

      Andrea

      Edited by: Andrea9 on 24-mar-2010 07:21
        • 1. Re: Problem creating a row in a table that has two composition keys.
          Krithika
          How are you inserting the value for refIdTableB..? The error could be related to this field as Table C has association with Table B as well.

          Also, at database level does these fields have Primary Key/Foreign Key relationship..?

          Check this blog as well: http://one-size-doesnt-fit-all.blogspot.com/2008/05/jbo-25030-failed-to-find-or-invalidate.html
          • 2. Re: Problem creating a row in a table that has two composition keys.
            680132
            Hi Krithika,
            first of all, thank you for your reply.
            I try to explain in a better way my problem

            At database level the primary key of every table is the field Id (IdA, IdB, IdC, of type DBSequence). There is two foreign keys: refIdTableA --> IdA and refIdTableB --> IdB.
            I would like to create a row in TableC, that it is a child of tableA, and where I can choose refIdTableB among the records in tableB (using a LOV that I have just created, I see correctly the rows just inserted in TableC).
            I have just read that blog, but it is not about my problem.
            I don't know how to create a new row? Declaritevely, programmatically? I have no idea.
            I would like to create a new row in tableC where refIdTableA = IdA (tableA is its master table) and refIdTableB settable by a LOV.

            Thank you
            • 3. Re: Problem creating a row in a table that has two composition keys.
              Krithika
              when you are creating row in tableC are you using existing value of TableA idA in refIdTableA or you are populating a new value for that field and trying to propogate that new value as a new record in your master table (Table A)as well..?

              I dont see any issues around refIdTableB since its populated through LOV. However, with refIdTableA column if the value that create doesn't exists in TableA idA column then you will hit this error if you don't handle the creation of new row in master table.
              • 4. Re: Problem creating a row in a table that has two composition keys.
                680132
                When I am creating a row in tableC I am using existing value of TableA idA in refIdTableA (so there is the value on master table) , while I want that other attributes of TableC are editable.
                The associations that links tableA --> tableC and tableB-->tableC are composition association optimize for database cascade delete, Lock top-level container.

                I don't know what is the right way to realize it... declarative? programmatically? if programmatically, how can implement it? using tableAEOImpl.java, or tableAVOImpl.java or myAppModuleImpl.java?

                I have tried in a declarative way: using the createWithParams of tableC, passing as parameter the value of refIdTableA (I have this value because I am in a master/detail), but when I click on it, I have this error:
                Impossibile to find or invalidate the property entity: entity TableCEO, row Key oracle.jbo.Key[-158 ]. oracle.jbo.InvalidOwnerException
                I think I have this error because I have two composition relationship on TableC. Is there a solution? I need both two composition relations


                Thank you

                Edited by: Andrea9 on 24-mar-2010 07:35
                • 5. Re: Problem creating a row in a table that has two composition keys.
                  Krithika
                  Which Create or Create with Params you are using..? I guess in your data controls, you will be having tableC VO directly as well as table C VO as a child to table A VO. If you use Create / Create with Params from table C VO which is under table A, then it should work. Otherwise, if you use Create under the direct ones then you will get this error. Hope it is clear for you.

                  Alternatively, check this sample for programmatic implementation. Hope this helps.

                  http://radio-weblogs.com/0118231/stories/2003/01/17/whyDoIGetTheInvalidownerexception.html

                  regards,
                  ~Krithika
                  • 6. Re: Problem creating a row in a table that has two composition keys.
                    680132
                    Yes, it is clear for me. I am using the CreateInsert/Create with Params in my data controls, where table C VO is a child to table A VO.
                    I think I have this error because I have two composition associations on the tableC (one with tableA and one with TableB).

                    I think that link is not good for my problem: I have just a master row (tableA), but I want to create a detail row in a table (tableC) that has a composition association with another table (tableB).
                    Then I don't understand a thing on that link: where have I to put the code that there is in the void main? I have not/don't find my main method.

                    Thanks
                    • 7. Re: Problem creating a row in a table that has two composition associations.
                      757019
                      I had a very similar problem as you. Check out this article Steve Meunch wrote back in 2002.

                      HOWTO: Implementing a ViewObject with Multiple Updateable Dependent Entity Objects
                      • 8. Re: Problem creating a row in a table that has two composition associations.
                        680132
                        Thank you JoeScheirich.
                        If I have understood, I Have to read/implement the response of Steve Munch to Tullio's post. It's ok?

                        Thank you.
                        • 9. Re: Problem creating a row in a table that has two composition keys.
                          Krithika
                          As I understand, in your case you are not creating any master record during child record creation. Hence, you could create a custom method in AMImpl and expose that custom method as a client method. Once done, create an operation binding for this client method and invoke that from your bean.

                          regards,
                          ~K
                          • 10. Re: Problem creating a row in a table that has two composition keys.
                            680132
                            You have understood well. This is my case.
                            Few days ago, I have created a method in AMImpl and I have exposed it. In my page, I dragged and dropped directly that method and I did not invoke that from my bean.
                            I don't understand why I have to invoke it from my bean and not directly from myAM.
                            I tried to use something similar that there is in the paragraph "4.12.4 How to Create a New Entity Row" of the manual. When I called the method to create the detail row I have the error because the detail row has two master.
                            • 11. Re: Problem creating a row in a table that has two composition keys.
                              680132
                              I have just tried the solution described after Tullio's post, but I have this error:
                              "myFK" violated during the INSERT operation with the instruction SQL "BEGIN INSERT INTO myTable(ID,ID1,ID2) VALUES (:1,:2,:3) RETURNING ID INTO :4; END;".

                              Now I will try doing a method in myApplicationModule.