Topic
  • No replies
SystemAdmin
SystemAdmin
11979 Posts

Pinned topic Data insertion in multiple tables having parent child relationship

‏2011-07-08T18:00:51Z |
I'm trying to insert data in two tables, where the primary key of one table is the foreign key in another table. For example, AUTHOR with primay key as author_id is related to BOOK table where author_id is the foreign key. In the attachment the exact BO is pasted. The primary key in Author table is populated with an Oracle Sequence, but i'm unable to pass that value to the author_id column of Book table. I get the following exception -

<result xsi:type="af:IntegrityConstraintFault" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:af="http://com/ibm/j2ca/fault/afcfault">
<message>The foreign keys {author_id=0} in child Business Object are inconsistent with the primary keys in parent Business Object {author_id=62}, error code: </message>
<errorCode></errorCode>
<primaryKeySet>
<keyName>book_id</keyName>
<keyValue>0</keyValue>
</primaryKeySet>
</result>

Please help me to resolve this issue.