Composition association

I have a composition association defined between some Entities with a "shared" primary key (ie, the key is generated for the top level entity and then the same value is used for the primary key of the subtables). If I define a separate View Object for each Entity and View Links between them, I can put them into an AppModule and testing them using the inbuilt tester they behave as I wish, particularly with inserts automatically propagating the primary key to the subtables. But if try to define a single View Object for the entire composition, then the inbuilt tester does not allow me to set values for the sub-entities when inserting a new record, nor does it seem to pre-populate the primary key as it does when using the View Link structure. It also does not handle updates properly, it throws an exception (see below). I have set the "updatable" checkbox in the View Object setup.
Is this a bug in the inbuilt tester, or am I simply not able to define composition View Objects in this way and must use the View Objects connected by View Links structure that I originally set up?
Exception thrown by tester attempting to update composition View Object -
oracle.jbo.DMLException: JBO-26080: Error while selecting entity for [First Subtype] at oracle.jbo.server.OracleSQLBuilderImpl.doEntitySelect(OracleSQLBuilderImpl.java:86) at
oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:5025) at
oracle.jbo.server.EntityImpl.populate(EntityImpl.java:4220)      at
oracle.jbo.server.EntityDefImpl.createRowFromDatabase(EntityDefImpl.java:1019) at oracle.jbo.server.EntityDefImpl.findFromDatabase(EntityDefImpl.java:1039) at
oracle.jbo.server.EntityDefImpl.findByPrimaryKey(EntityDefImpl.java:1132) at
oracle.jbo.server.ViewObjectImpl.updateReferenceEntities(ViewObjectImpl.java:8443) at
oracle.jbo.server.ViewObjectImpl.afterRowUpdate(ViewObjectImpl.java:7685)
...

Hello again,
I think i should better make my problem more simple so maybe i can have some help.
There are 3 entity objects, User, Customer, ContactInformation.
Users and contact information have 1-1 relationship (via User's Id attribute and ContactInformation's parentId attribute)
Customer and Contact information have 1-* relationship (via Customer's Id attribute and ContactInformation's parentId attribute)
None of these are composition association.
There's no problem about Customers and Contact Information. I made a view link between these and i can persist and retrieve data without problem.
I want to be able to enter user's contact information in same view which is something like: (Query is generated by adding entity objects to view definition, and "reference" checkbox is unchecked for URL)
SELECT User.Id, User.FirstName, User.LastName, ContactInformation.Email, ContactInformation.PhoneNumber
FROM USERS User, CONTACT_INFORMATIONS ContactInformation
WHERE User.Id = ContactInformation.ParentId
When i use like this, ContactInformation's parentId is not set.
If i check "composition association" in association definition, parentId is persisted but this time, i cannot use ContactInformation entity for any other entity.

Similar Messages

  • Composition Association in a region

    I have read Steve Muench blog:
    [http://one-size-doesnt-fit-all.blogspot.com/2008/05/jbo-25030-failed-to-find-or-invalidate.html|http://one-size-doesnt-fit-all.blogspot.com/2008/05/jbo-25030-failed-to-find-or-invalidate.html]
    I have a simple master-detail relation (ex: Departments and Employees). I marked the association between entities as Composition Association.
    In my AM, I have only: Employees view as a detail of Departments view.
    In my page: Departments (master one) is a form and Employees (detail one) is a table.
    If I click "New Department" button, create(AttributeList attributeList) is fired from DepartmentsEntityImpl.
    Than, when I click "New Employees" button, create(AttributeList attributeList) is fired from EmployeesEntityImpl.
    If I click Commit, 2 new records are created and everything works like a charm.
    But my problem is when Employees view is in a region (sepatrate task flow with "Share data controls with calling task flow" behavior, and no input parameters).
    I am still using the Employees view which is a child of Departments.
    The navigation works fine. Navigating different departments, always refreshes the Employees table in the region, (So master-detail relation works fine.)
    The update works fine. Change something in a Department form, than change employees records and than click Commit button - updates everything.
    BUT now, cascading insert does not work.
    If I click "New Department" button, create(AttributeList attributeList) is fired from DepartmentsEntityImpl.
    Than, when I click "New Employees" button, create(AttributeList attributeList) is fired from EmployeesEntityImpl ::
    protected void create(AttributeList attributeList) {
    super.create(attributeList);
    this.setActiveFlag("Y");
    but I never rich: this.setActiveFlag("Y") - line. The pop up error is:
    Detail entity EmployeesEntity with row key oracle.jbo.Key[-21 ] cannot find or invalidate its owning entity.
    So, when the detail-view is on the page together with a master-view, everything is OK.
    When the detail-view is in a region, insert doesn not work.
    Can the detail-view BE in a region?
    Am I doing something wrong?

    When a new row is created through the ADF data binding layer, its new row status will be "STATUS_INITIALIZED" (and it will contain the create-time defaulted values).
    In order to transition from STATUS_INITIALIZED to STATUS_NEW, some additional attribute must be set on the model.
    This will occur when you submit your changes, or when individual field values are sent to the server due to their UI component's being marked AutoSubmit=true.
    When the master row is STATUS_NEW, then a newly-created, composted child row will be able to find its parent in the cache and no error will result.
    In contrast, if at the moment of creating the detail, the master row is still STATUS_INITIALIZED, then it will not be found in the cache and you'll get the InvalidOwnerException.
    In the case of separate regions, you might experiment with setting the skipValidation property on the pageDefinition to "skipDataControls" to avoid causing model-layer validation to occur on items that are not part of that region's page definition.

  • How to manage Constraints for Non-Composition Associations?

    Hi
    Assuming the following Situation:
    Company - Entity with Primary Key Attribute CompId
    Person - Entity which is associated to Company as a detail via a NON-composition association ("employedAssoc") using Attribute CompId.
    PERS_COMP_FK - a database foreign key between the tables of Company (master) and Person (detail) making sure Person is not employed at a non-existing company.
    Now I want to implement a code which sets the FK-Attribute CompId in Person to <null> (unemployed) if Company is deleted (bankrupt). I tried the following code, implemented in Company:   public void remove()
        // set Attribute CompId in Person to null
        RowIterator iter = getPersons();
        while (iter.hasNext())
          PersonImpl person = (PersonImpl) iter.next();
          person.setCompId(null);
        // remove Company
        super.remove();
      }Unfortunately this code throws oracle.jbo.DMLConstraintException: "Constraint PERS_COMP_FK violated during post operation: "DELETE FROM Company WHERE COMP_ID = :1" "What's going wrong here?
    Any hints are welcome
    Thanks
    Frank Brandstetter

    Well, I don't think it is a bug.
    When you set the foreign key to null, you are already INSIDE the postChanges process. I don't really see what the framework should do. Stop the post on one entity and take another one? No idea...
    If you perform a custom action BEFORE triggering commit/post where you set the foreign keys to null, this might work properly (if compositions are present). Though...
    HTH,
    Adrian

  • Why is the child table inserting first in a composite association?

    Guys and Gals,
    Studio Edition Version 11.1.1.3.0.
    This one has gotten me all day. I have a child table which is inserting before its master table, even though the relationship is defined as a composite relationship.
    Process:
    1) User adds a part with a purchase price into the Part table.
    2) Via Part-PartHistories View Link, part is inserted into PartHistories.
    3) Via BPL-BPLRows View Link, part is inserted into BPLRows along with its purchase price. The part number is part of a composite primary key (BPL,PartNumber) and is a foreign key to the Part table.
    4) Via BPL-PL View Link, and then Via PL-PLRows View Link, part is inserted into PLRows along with its purchase price. The part number is part of a composite primary key (PL,PartNumber) and is a foreign key to the Part table.
    It is #4 which gives me an integrity constraint (PCS.PRICE_BUCKETS_PARTS_FK1) violated - parent key not found error. JDev is trying to insert in the order 4,1,2,3 when it should be 1,2,3,4. The kicker is that there is a composite association between #1 and #4 which should guarantee that 1 is inserted first. If I remove #4's process, steps 1-3 run fine. If I remove the composite association, JDev inserts correctly steps 1,2,3,4.
    Why is JDev trying to insert #4 first? I do a CreateInsert on the Parts table first so the creation order is correct. Furthermore, there is a composite association defined between Parts - PLRows.
    Something is indeed fishy in Denmark.

    LovettWB,
    You talk about VOs, but composite relationships need to be defined at the EO level. If you have indeed defined the proper composite associations, this sounds like a perfect test case to submit to Oracle Support to evaluate.
    If you do have the proper associations set up and things don't work, you could try [url http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcadveo.htm#CEGECADE]this technique as a workaround.
    John

  • How to retrieve/query composition association data

    Hi guys,
    I have requirement to query retrieve data from appointments Follow-Up table. What I see in UI designer Follow-Up data list is mapped to composition association
    By structure I see that actually it is BusinessTransactionDocumentReference association, but in Apportunity's TI there is no query or other visible configuration how these following records are filtred out.
    That why I have question - how can I access in my PDI coding to this FollowUp association so I could grab UUIDs and retrieve these appointments?
    Thanks,
    Uldis

    Hello Uldis,
    Composition associations are just a pointer from a parent node to a child node and vice versa (ref. documentation SDK1405 p.679). So accessing the data in the nodes should not be problematic.
    Perhaps with more information on your context's issue, somebody could help you.
    In which Business Object are you? A Custom one or a standard BO?
    What is the screen you are in for this Data List?
    Thanks,
    Regards,
    Jacques-Antoine

  • Warning: Entity participates in more than one composition association

    Hi,
    I am having a scenario...
    Where I have 3 tables..
    1.Employee - Id(Sequence),FName,LName,AddressId(FK),TelephoneId(FK)
    2.Address- Id(Sequence),City,State
    3.Telephone- Id(Sequence),Office_No,Mobile_No
    I need to create a VO - UserDetailsVO which has all attributes from these tables
    I should have a form which has all the fields like FName,LName,City,State,Office_No,Mobile_No..
    and one commit it should update my Foreign Keys in Employee table with the AddressId and TelephoneId.
    It will be more helpful if you can guide me with sample tutorial for this scenario..
    It works when I tried for updating with one relationship(I added the behaviour composition association in my Association),
    But when I added another relationship,It was showing me "Warning: Entity EmployeesEO participates in more than one composition association. This will require custom composition management in your application for secondary masters."
    Please help me how to handle this kind of scenario..
    Thanks

    Any thoughts about this guys?

  • Query Related to composite association.

    Is it possible to have a composite association between two entity objects which is used for master detail record entry using a single create button where the PK for both the EO is NOT of "DBSequence" type?
    Edited by: 909869 on Apr 2, 2012 6:10 AM

    it would be something like this, Try this
    1 localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swaptxt
    2 localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean trans3
    3 localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swapxml
    4 localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean trans2
    5 localejbs/AF_Modules/PayloadSwapBean Local Enterprise Bean swappdf
    6 localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean trans1
    7 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
    swapxml -> swap.keyName -> payload-name
    swapxml> swap.keyValue> file2
    swappdf -> swap.keyName -> payload-name
    swappdf> swap.keyValue> file1
    trans1> Transform.ContentDescription>file1
    trans1> Transform.ContentDisposition>attachment
    trans1> Transform.ContentType>application/pdf;name="file1.pdf"
    trans2>Transform.ContentDescription>file2
    trans2>Transform.ContentDisposition>attachment
    trans2> Transform.ContentType>application/xml;name="file2.xml"
    trans3> Transform.ContentDescription>file3
    trans3> Transform.ContentDisposition>attachment
    trans3> Transform.ContentType>application/txt;name="file3.txt"
    mail --> mime.contenttype   --> multipart/mixed
    I have not tried this myself. but it should work

  • Create Operation for Master-Detail Relationship Using Composite Association

    My requirement is to insert record for both the master and the detail at the same time using a single create insert action.I was successful in doing so using the composite association but when I am trying to commit the new record, I am getting the error that for the primary key Null value cannot be inserted.Then, I made the PK for both the master and detail EO's as DBSequence type which resolved the issue.
    My query is , Is there any alternative way to fulfill my requirement by "NOT" using the type for primary key to be DBSequence type?
    Thank you for your help.

    I also want to insert into master detail table in single form but when I insert in master form and then go to detail form for inserting value the master data automatically loss when I press detail create insert button. I am Using Two create insert button one for master and one for detail.
    I have also tried this function for solving my problem in other way but the problem is same
    public String cb8_action() {
    // Add event code here...
    BindingContainer bindings =BindingContext.getCurrent().getCurrentBindingsEntry();
    //OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
    //Object result = operationBinding.execute();
    OperationBinding operationBinding1 = bindings.getOperationBinding("CreateInsert1");
    Object result1 = operationBinding1.execute();
    if (!operationBinding1.getErrors().isEmpty()) {
    return null;
    return null;
    Please Help me.

  • Association Wizard; DB Constraints, Composition, & Cascades

    A couple of clarifications please:
    1. When would I want (ie 'be better off) with a composite association (fk) that is NOT in the database and only at he bc4j level.
    2. If I do want the fk in the database, how can I specify (page 3 of 3 of the wizard) the cascade rules -for the database- per deletes, per updates. (Assuming that I don't set the composition checkbox on.)
    2b. If I can't specify, but manually set that in the database, will the synch 'leave it alone'?
    3. If I do check the Composition box, are these setting forward generated?
    4. What does the 'top level container' setting do for a)bc4j and b) the database.
    Thanks again
    -Nat

    A couple of clarifications please:
    1. When would I want (ie 'be better off) with a composite association (fk) that is NOT in the database and only at he bc4j level.Composition association implies a lock, validation and post ordering amongst BC4J entities. Now you may have database constraints or not(legacy databases) to use this feature. The only feature that you may not be able to use is Cascade-delete as that assumes there's a cascade delete constraint on the FK.
    2. If I do want the fk in the database, how can I specify (page 3 of 3 of the wizard) the cascade rules -for the database- per deletes, per updates. (Assuming that I don't set the composition checkbox on.) Cascade delete is only allowed during composition. Cascade update ...? is not implemented by BC4J.
    2b. If I can't specify, but manually set that in the database, will the synch 'leave it alone'?I do believe so but have not tried. From what I remember (from my usages), sync feature does not update the composition flag.
    3. If I do check the Composition box, are these setting forward generated?Yes if you select the cascade-delete option which generates a cascade delete constraint on the FK.
    4. What does the 'top level container' setting do for a)bc4j and b) the database.This is a BC4J only option where you can selectively choose not to lock the parent when editing a child. This allows for a hierarchy of composed entities to work simultaneously on different entities on separate branches. Like say a project contains packages contains classes. Now one can work on classes in different packages and choose not to lock the whole project down, but would want to lock the pacakge.
    Thanks again
    -Nat

  • Composition vs. Association Associations

    Using JDev 11.1.1.1 created a Model project using Dept and Emp. This gives a foreign key assoc between Dept-Emp. When I edit this association the Composition Association (CA) checkbox is not checked indicating that this is an Association Association (AA)? If this is the case then I will have to write code to ensure the correct order of commit to a database? If I am working with a Composition Association I believe the ordering of the commit is handled by the framework so I do not get an error, i.e. insert a emp record without a corresponding dept record.
    Question is is the association that is created an AA or a CA? If an AA is it advisable to edit the association to a CA or write code to make sure of the proper insertion order into the database?
    Thanks - Casey

    Hi,
    if the relationship between two entities is such that the child entity cannot be without the parent entity (like in order and order-item) then you should make it a composition. As you can see, the composition setting is a by use case decision, which is why it isn't set by default. If you can, setting the composition flag simplifies your developer life big times
    Frank

  • Bug in New Association Wizard [jdev903/bc4j]

    Hi,
    in the wizard for creating a new Association between two entities, the multiplicity lacks the option '1 : 0..1'.
    As a workaround you can create the association the other way round, because '0..1 : 1' is present, but then you can't use the 'Composition Association' checkbox (the composition would end up on the wrong side).

    I've filed Bug#2657816 to track this issue. Thanks.

  • Populate PK(DBSequence) in three related tables with master detail association

    Hi
    I use jdeveloper 11.1.1.6.0.
    My English isn't very good.
    I have 3 tables with master detail association between them and primary key from table A should populate to tables B and finally C .The primary key is a sequence from data base and I set PK attribute in table A as a DBSequence. (table C is the child of table B  and table B is the child of table A)
    My association is like this: A->B(BAFk1Assoc) and B ->C(CBFk1Assoc)  and also I select Composition Association for these two association. And I select ‘Cascade Update Key Attribute’
    When I insert row in these three related tables, a negative number create but when I COMMIT the PK populate only to table B not to table C and the exception below raises:
    Constraint "C_B_FK1" is violated during post operation "Insert"
    ORA-02291: integrity constraint (HR.C_B_FK1) violated - parent key not found.
    If I only work with tables A and B, there isn't any problem but if I add table C as the child of B, this exception raises.
    Habib

    The question is how you create the row for table C. Do you create it as child from table b (using the VO for B and using the link to C)?
    In this case the framework should populate the PK of the master row B as FK in table C.
    You may need to control the order in which the rows are posted to the DB to avoid this problem. Read Advanced Entity Object Techniques - 11g Release 1 (11.1.1.6.0) to get more info about this.
    However, sometimes it's easier to control the generation and setting if the PK attributes in the model layer, not relating on db triggers where you get the real values only after the commit operation is done in the db. For this you can use a Groovy expression so you have access to the PK of each new created row right after creation. Read Using Groovy Expression to set a Primary Key with a Sequence Number | JDev &amp;amp; ADF Goodies to find out how to do this.
    Timo

  • Insert master and detail rows with Composition assoc generating JBO-26048

    I have the Master and Detail Entity Objects and made an Association linking them as Composition related.
    I have 2 ViewObjects. the MasterViewObject is composed of the Master entity object and 1 other udpateable object. the DetailViewObejct only contains the Detail entity Object.
    I tried to create a row on the masterviewobject and then immeidately create a detail row, and then commit, ADF issues a JBO-26048 error. Constraint "MY_FK" violated during post operation.... ".
    I don't know wahts wrong, but this should not be error should nit be appearing, as ViewObjects and the Links with Composition Association take care of populating the Foreign Keys of the detail. Or am I missing something here?

    The ADF Guide covers this problem, and I have a method that works as well on jdevguru.com. Take a look at the manual first, they have an indepth view on it and how to get it all to work together.
    Kelly

  • Delete entity that participate in many to many association

    Hi all,
    I have two tables related by a many to many relationship (for ex department and employee).
    So I have three tables:
    Department: table of departments
    Employee: table employees
    deptEmp: the association table relating the employees to the departments.
    When a department is deleted, all the corresponding rows in deptEmp table should also be deleted (and same for employee).
    On the entity level, I have created the many to many association (between department and employee) and a one to many association for each of department and employee entities to deptEmp entity (deptEmptAssoc from department to deptEmp and empDeptAssoc employee  to deptEmp).
    I configured the deptEmptAssoc association to be a composition and implement the cascading delete, and it is working fine. When I delete a department, the corresponding rows in deptEmp are deleted.
    The problem is that when I try to do the same for empDeptAssoc, JDev gives me a warning and doesn’t apply the composition neither the cascading delete.
    I tried to override the remove method of employee entity to also remove the corresponding deptEmp but it also didn’t work.
    So any hint or pointer how to achieve this? How to have a many to many association and be able to delete both sides of the association?
    Thank you.

    Hi,
    This behavior can be done by overriding the postChanges method as follow:
      public void postChanges(TransactionEvent transactionEvent) {
            if(getPostState() == STATUS_DELETED){
                RowIterator mmIterator = getMM();
                while (mmIterator.hasNext()){
                    EntityImpl row = (EntityImpl)mmIterator.next();
                    row.remove();
    row.postChanges(transactionEvent);
            super.postChanges(transactionEvent);
    N.B.1  In the xml file of the viewLink, the composition association (and implement cascade delete) should not be checked.
    N.B.2  with these flags unchecked, ADF will not control the posting of entities in case the department and the deptEmp entities were both newly created. To fix the issue, the deptEmp entity should also override the postChanges method as follow:
                        public void postChanges(TransactionEvent transactionEvent) {
            if (getPostState() == STATUS_NEW ||
                  getPostState() == STATUS_MODIFIED) {
                EntityImpl dept = getDept();
                if (dept != null) {
                  if (dept.getPostState() == STATUS_NEW) {
    dept.postChanges(transactionEvent);
                                                    // do the same for the Employee entity if needed
            super.postChanges(transactionEvent);
    Regards.

  • Many-to-many association: inserting in the detail table fails

    I'm using jdeveloper 11g and configured the many-to-many association as described in the documentation, so I have accessors in both directions, with composition association and a many-to-many link view. Using the business component browser, the link view works for viewing the data in both directions, as one would expect, however inserting in the detail table fails as follows: the key of the master table is the new value of the detail table's key column instead of the intersection table's foreign key column. Is this a known problem, or is there something I have done wrong?

    If your m-m join table has additional fields there best solution is normally to define a class for the join table.
    i.e.
    beforeProgram
    -m-m-> Assumption
    Assumption
    -m-m-> Program (optional/read-only)
    -> after
    Program
    -1-m-> ProgramAssumptionAssociation (private-owned)
    ProgramAssumptionAssociation
    -1-1-> Program (pk)
    -1-1-> Assumption (pk)
    - createByUser
    - etc.
    Program
    -1-m-> ProgramAssumptionAssociation (independent/optional)
    You could also enable batch-reading or joining on the 1-1 relationship to read the target objects efficiently.

Maybe you are looking for

  • How to get text flow onto the next page from template "travel journal"?

    When wanting to create a new document, I chose "Travel journal" between "side layouts" in templates. When it opens, you see one page with pictures and example of text. When I start to write my text in the text field, it disappears when I get to the e

  • Acrobat XI crashes when opened

    Adobe Acrobat XI has been working fine for months.  I have it installed on 5 machines all with Windows 7 and the same specs.  Every time I attempt to open the program or a pdf file, Acrobat crashes. I logged into 4 of the 5 machines yesterday and did

  • Problems with 0:00:00:00 timecode

    I'm recording night live show using tape recorder with TC from studio (real-time) watches. Please, give the solution on how to capture the material starting at 23:50:00:00 and ending at 00:10:00:00 recorded on tape. Also, please, explain how can I ed

  • ERM - Adding Function to a Role

    Hi all,         I have the following problem. when we add a Function to a Role in ERM, the transactions are added but the authorization values don't. Does anyone know something about this issue?? Kind Regards!! Isaac

  • What is ISU and  CRM?

    Can u give me information about ISU and CRM