This discussion is archived
8 Replies Latest reply: May 11, 2013 1:16 AM by user576183 RSS

Commit both parts of a "references" association together

user576183 Newbie
Currently Being Moderated
I'm running JDev 11.1.2.3.0.

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?

Many thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points