I have an Entity Association between TABLE_A and TABLE_B Entities in a 0..1 -> * references relationship. I will either be creating just a record in TABLE_B or records in both TABLE_B and TABLE_B.
When creating records in both Entities I want both records to form an atomic transaction; either commit both or rollback. The problem is that if I try to commit both at the same time, the child record won't insert because the parent PK has changed from the temporary negative number. If I set the Association to be a Composite Association, committing both records together works, but I am then unable to commit a single record in TABLE_B on it's own.
What is the recommended solution for this situation?
You should use the composite relationship for the association.
You should be able to add a VO that is just on Table_B without a master view related to it in a view link.
Using that view you should be able to insert recrods directly into table_B without first inserting records into table a.
A couple of question - when you are inserting data into the new VO - are you filling in the value for the field that connects to the master (basically the deptID in an emp/dept scenario)?
Also in your composite association did you mark the behavior to "update top-level history column"?
The referencing field in the "child" table isn't mandatory. This is why I really want to use a references association, I just couldn't get it working so I tried the composition association.
The relationship is TABLE_A 0..1 -> * TABLE_B. The two are independent; I'm either going to insert into both tables or just TABLE_B.
What I'm trying to do is the equivalent of:
INSERT INTO TABLE_A()
RETURNING ID INTO TABLE_A_ID_VAR;
INSERT INTO TABLE_B(TABLE_A_ID)
INSERT INTO TABLE_B()
I don't understand how one does the two table insert with TABLE_B referencing TABLE_A in ADF. If I try to do that with just a "references" association, I see TABLE_B FK is initially populated with the temporary negative ID of TABLE_A, but isn't updated on COMMIT with the actual ID.