ORA-02291 Integrity Constraint exception - 1:1 in BPEL context

Hi,
I am using toplink inside a BPEL process (DB adapter).
I have a table PARTY with PK PARTY_ID and a table BILL_TO_CUSTOMER with PK BILL_TO_CUSTOMER_ID. They can be linked 1:1 using PARTY_ID = BILL_TO_CUSTOMER_ID. It works absolutely fine for update or select operations, but for inserts (using merge) NOT. I get an ORA-02291 error. From the log where I can see the tried SQL command the reason is obvious: He is trying to insert the BILL_TO_CUSTOMER before the PARTY and this does not work as there is a constraint.
How do I have to change my toplink_mapping XML to get this working?
Thank you very much, Best Regards,
Martin
<?xml version="1.0" encoding="UTF-8"?>
<toplink:object-persistence version="Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)" xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<opm:name>BillToCustomerParty</opm:name>
<opm:class-mapping-descriptors>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>BillToCustomerParty.BillToCustomer</opm:class>
<opm:alias>BillToCustomer</opm:alias>
<opm:primary-key>
<opm:field table="BILL_TO_CUSTOMER" name="BILL_TO_CUSTOMER_PARTY_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="findAllBillToCustomer" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>BillToCustomerParty.BillToCustomer</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
<toplink:does-exist-query xsi:type="toplink:does-exist-query">
<toplink:existence-check>check-database</toplink:existence-check>
</toplink:does-exist-query>
</opm:querying>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:one-to-many-mapping">
<opm:attribute-name>contactInformationCollection</opm:attribute-name>
<opm:reference-class>BillToCustomerParty.ContactInformation</opm:reference-class>
<opm:private-owned>true</opm:private-owned>
<opm:target-foreign-key>
<opm:field-reference>
<opm:source-field table="CONTACT_INFORMATION" name="PARTY_ID" xsi:type="opm:column"/>
<opm:target-field table="BILL_TO_CUSTOMER" name="BILL_TO_CUSTOMER_PARTY_ID" xsi:type="opm:column"/>
</opm:field-reference>
</opm:target-foreign-key>
<toplink:batch-reading>true</toplink:batch-reading>
<toplink:container xsi:type="toplink:container-policy">
<toplink:collection-type>oracle.toplink.indirection.IndirectList</toplink:collection-type>
</toplink:container>
<toplink:indirection xsi:type="toplink:transparent-collection-indirection-policy"/>
<toplink:selection-query xsi:type="toplink:read-all-query">
<toplink:reference-class>BillToCustomerParty.ContactInformation</toplink:reference-class>
<toplink:container xsi:type="toplink:container-policy">
<toplink:collection-type>oracle.toplink.indirection.IndirectList</toplink:collection-type>
</toplink:container>
</toplink:selection-query>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>billToCustomerPartyId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="BILL_TO_CUSTOMER_PARTY_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>externalBillToCustomerId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="EXTERNAL_BILL_TO_CUSTOMER_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>hashAlgorithmValue</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="HASH_ALGORITHM_VALUE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>lastName</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="LAST_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>firstName</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="FIRST_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>middleName</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="MIDDLE_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>nameSuffix</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="NAME_SUFFIX" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>namePrefix</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="NAME_PREFIX" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>customerOrganizationName</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="CUSTOMER_ORGANIZATION_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressOrganizationName</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_ORGANIZATION_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressDepartment</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_DEPARTMENT" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressContactName</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_CONTACT_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressBuilding</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_BUILDING" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressStreet</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_STREET" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressHouseNumber</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_HOUSE_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressPoBox</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_PO_BOX" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressLocality</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_LOCALITY" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressPostalCode</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_POSTAL_CODE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressProvince</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_PROVINCE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressFormatted</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_FORMATTED" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>genderType</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="GENDER_TYPE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>dateOfBirth</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="DATE_OF_BIRTH" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>clientOrganizationPartyId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="CLIENT_ORGANIZATION_PARTY_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>phoneNumber</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="PHONE_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>faxNumber</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="FAX_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>mobileNumber</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="MOBILE_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>emailAddress</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="EMAIL_ADDRESS" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>lastUpdated</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="LAST_UPDATED" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressCountryId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="ADDRESS_COUNTRY_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>currentContactInformationId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER" name="CURRENT_CONTACT_INFORMATION_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:one-to-one-mapping">
<opm:attribute-name>billToCustomerGroup</opm:attribute-name>
<opm:reference-class>BillToCustomerParty.BillToCustomerGroup</opm:reference-class>
<opm:foreign-key>
<opm:field-reference>
<opm:source-field table="BILL_TO_CUSTOMER" name="BILL_TO_CUSTOMER_GROUP_ID" xsi:type="opm:column"/>
<opm:target-field table="BILL_TO_CUSTOMER_GROUP" name="BILL_TO_CUSTOMER_GROUP_ID" xsi:type="opm:column"/>
</opm:field-reference>
</opm:foreign-key>
<opm:foreign-key-fields>
<opm:field table="BILL_TO_CUSTOMER" name="BILL_TO_CUSTOMER_GROUP_ID" xsi:type="opm:column"/>
</opm:foreign-key-fields>
<toplink:batch-reading>true</toplink:batch-reading>
<toplink:selection-query xsi:type="toplink:read-object-query">
<toplink:reference-class>BillToCustomerParty.BillToCustomerGroup</toplink:reference-class>
</toplink:selection-query>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
<toplink:always-refresh>true</toplink:always-refresh>
</toplink:caching>
<toplink:remote-caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
</toplink:remote-caching>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="BILL_TO_CUSTOMER"/>
</toplink:tables>
</opm:class-mapping-descriptor>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>BillToCustomerParty.BillToCustomerGroup</opm:class>
<opm:alias>BillToCustomerGroup</opm:alias>
<opm:primary-key>
<opm:field table="BILL_TO_CUSTOMER_GROUP" name="BILL_TO_CUSTOMER_GROUP_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="findAllBillToCustomerGroup" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>BillToCustomerParty.BillToCustomerGroup</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
<toplink:does-exist-query xsi:type="toplink:does-exist-query">
<toplink:existence-check>check-database</toplink:existence-check>
</toplink:does-exist-query>
</opm:querying>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>billToCustomerGroupId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER_GROUP" name="BILL_TO_CUSTOMER_GROUP_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>clientOrganizationPartyId</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER_GROUP" name="CLIENT_ORGANIZATION_PARTY_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>description</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER_GROUP" name="DESCRIPTION" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>code</opm:attribute-name>
<opm:field table="BILL_TO_CUSTOMER_GROUP" name="CODE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
<toplink:always-refresh>true</toplink:always-refresh>
</toplink:caching>
<toplink:remote-caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
</toplink:remote-caching>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="BILL_TO_CUSTOMER_GROUP"/>
</toplink:tables>
</opm:class-mapping-descriptor>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>BillToCustomerParty.ContactInformation</opm:class>
<opm:alias>ContactInformation</opm:alias>
<opm:primary-key>
<opm:field table="CONTACT_INFORMATION" name="CONTACT_INFORMATION_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="findAllContactInformation" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>BillToCustomerParty.ContactInformation</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
<toplink:does-exist-query xsi:type="toplink:does-exist-query">
<toplink:existence-check>check-database</toplink:existence-check>
</toplink:does-exist-query>
</opm:querying>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>hashAlgorithmValue</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="HASH_ALGORITHM_VALUE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>lastName</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="LAST_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>firstName</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="FIRST_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>middleName</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="MIDDLE_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>nameSuffix</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="NAME_SUFFIX" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>namePrefix</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="NAME_PREFIX" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>organizationName</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ORGANIZATION_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressOrganizationName</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_ORGANIZATION_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressDepartment</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_DEPARTMENT" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressContactName</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_CONTACT_NAME" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressBuilding</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_BUILDING" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressStreet</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_STREET" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressHouseNumber</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_HOUSE_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressPoBox</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_PO_BOX" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressLocality</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_LOCALITY" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressPostalCode</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_POSTAL_CODE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressProvince</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_PROVINCE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressFormatted</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_FORMATTED" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>contactInformationId</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="CONTACT_INFORMATION_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>datetimeReceived</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="DATETIME_RECEIVED" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>dateOfBirth</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="DATE_OF_BIRTH" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>genderType</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="GENDER_TYPE" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>phoneNumber</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="PHONE_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>faxNumber</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="FAX_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>mobileNumber</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="MOBILE_NUMBER" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>emailAddress</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="EMAIL_ADDRESS" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>addressCountryId</opm:attribute-name>
<opm:field table="CONTACT_INFORMATION" name="ADDRESS_COUNTRY_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
<toplink:always-refresh>true</toplink:always-refresh>
</toplink:caching>
<toplink:remote-caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
</toplink:remote-caching>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="CONTACT_INFORMATION"/>
</toplink:tables>
</opm:class-mapping-descriptor>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>BillToCustomerParty.Party</opm:class>
<opm:alias>Party</opm:alias>
<opm:primary-key>
<opm:field table="PARTY" name="PARTY_ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="BillToCustomerPartySelect" xsi:type="toplink:read-all-query">
<opm:criteria operator="and" xsi:type="toplink:logic-expression">
<toplink:left operator="equal" xsi:type="toplink:relation-expression">
<toplink:left name="clientOrganizationPartyId" xsi:type="toplink:query-key-expression">
<toplink:base name="billToCustomer" xsi:type="toplink:query-key-expression">
<toplink:base xsi:type="toplink:base-expression"/>
</toplink:base>
</toplink:left>
<toplink:right xsi:type="toplink:parameter-expression">
<toplink:parameter name="clientOrganizationId" xsi:type="opm:column"/>
</toplink:right>
</toplink:left>
<toplink:right operator="equal" xsi:type="toplink:relation-expression">
<toplink:left name="externalBillToCustomerId" xsi:type="toplink:query-key-expression">
<toplink:base name="billToCustomer" xsi:type="toplink:query-key-expression">
<toplink:base xsi:type="toplink:base-expression"/>
</toplink:base>
</toplink:left>
<toplink:right xsi:type="toplink:parameter-expression">
<toplink:parameter name="externalBillToCustomerId" xsi:type="opm:column"/>
</toplink:right>
</toplink:right>
</opm:criteria>
<opm:arguments>
<opm:argument name="externalBillToCustomerId">
<opm:type>java.lang.String</opm:type>
</opm:argument>
<opm:argument name="clientOrganizationId">
<opm:type>java.lang.Integer</opm:type>
</opm:argument>
</opm:arguments>
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>BillToCustomerParty.Party</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
<opm:query name="findAllParty" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>BillToCustomerParty.Party</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
<toplink:does-exist-query xsi:type="toplink:does-exist-query">
<toplink:existence-check>check-database</toplink:existence-check>
</toplink:does-exist-query>
</opm:querying>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:one-to-one-mapping">
<opm:attribute-name>billToCustomer</opm:attribute-name>
<opm:reference-class>BillToCustomerParty.BillToCustomer</opm:reference-class>
<opm:foreign-key>
<opm:field-reference>
<opm:source-field table="PARTY" name="PARTY_ID" xsi:type="opm:column"/>
<opm:target-field table="BILL_TO_CUSTOMER" name="BILL_TO_CUSTOMER_PARTY_ID" xsi:type="opm:column"/>
</opm:field-reference>
</opm:foreign-key>
<opm:foreign-key-fields>
<opm:field table="PARTY" name="PARTY_ID" xsi:type="opm:column"/>
</opm:foreign-key-fields>
<toplink:batch-reading>true</toplink:batch-reading>
<toplink:indirection xsi:type="toplink:value-holder-indirection-policy"/>
<toplink:selection-query xsi:type="toplink:read-object-query">
<toplink:reference-class>BillToCustomerParty.BillToCustomer</toplink:reference-class>
</toplink:selection-query>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>partyId</opm:attribute-name>
<opm:read-only>true</opm:read-only>
<opm:field table="PARTY" name="PARTY_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>partyTypeId</opm:attribute-name>
<opm:field table="PARTY" name="PARTY_TYPE_ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.Integer</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>activeInd</opm:attribute-name>
<opm:field table="PARTY" name="ACTIVE_IND" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>createdDatetime</opm:attribute-name>
<opm:field table="PARTY" name="CREATED_DATETIME" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
<toplink:always-refresh>true</toplink:always-refresh>
</toplink:caching>
<toplink:remote-caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
</toplink:remote-caching>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="PARTY"/>
</toplink:tables>
</opm:class-mapping-descriptor>
</opm:class-mapping-descriptors>
</toplink:object-persistence>

I am replying to very old reported problem, since i struggled to get the right reason for this error.
In my database we had database constraint & associated trigger, On Insert the trigger gets Sequence. NextVal and inserts into PK column. This constraint trigger gets conflict with the Oracle Native Sequence Generator. I disabled the trigger and used my ESB native sequence (which also does sequence.nextVal) and it worked perfectly.
If the trigger is Must then make sure that there is If condition wherein it checks to set NextVal only if no input has been provided for PK. If input contains PK value then trigger should do nothing.

Similar Messages

  • ORA-02292: integrity constraint

    WHEN-BUTTON-PRESSED Trigger got the following Exception Error:
    Error:
    ORA-02292: integrity constraint <constraint name> violated - child record found
    Cause:
    You tried to DELETE a record from a parent table (as referenced by a foreign key), but a record in the child table exists.
    Action:
    The options to resolve this Oracle error are:
    ------------------------------ How Could i handel this Error pls ?
    Regards,
    Abdetu..

    Hello,Thanks Francois for reply
    By the way,i am deleting roots in a a tree from the database..
    DECLARE
      pk INSP_EQUIPMENT_TYPE.EQUIPMENT_TYPE_D%TYPE;
    BEGIN
      IF Ftree.Get_Tree_Property('TREE_BLOCK_TEST.TREE13', Ftree.SELECTION_COUNT) >= '1' THEN
        pk := ftree.get_tree_node_property(
            'TREE_BLOCK_TEST.TREE13',
            :system.trigger_node,
            ftree.node_value);
        DELETE FROM INSP_EQUIPMENT_TYPE
        WHERE EQUIPMENT_TYPE_D = pk;
      ELSE
        Message('Please select a tree node for deletion.');
      END IF;
      EXCEPTION
           WHEN OTHERS THEN
            MESSAGE('OTHERS'||SQLCODE ||' ' ||SQLERRM  );
           MESSAGE('OTHERS'||SQLCODE ||' ' ||SQLERRM  );
    END;Regards,
    Abdetu..

  • ORA-02292: integrity constraint - foreign key delete

    I am getting the above error message when attempting to delete an entry with a foreign key constraint. I have the standard delete button and the standard DML process for inset, update, delete, and a page validation conditioned on the delete button for EXISTS with the following code:
    select 1 from dual
    where (select count(*) from mdeccommitments
    where producer = :P25_COREID
    and receiver = :P25_COREID) = 0
    and (select count(*) from mdecbriefcal
    where primarytarget = :P25_COREID
    and primaryowner = :P25_COREID) = 0
    This code works in SQL directly. However, when I try to run this, I do not get the inline error associated with the validation routine, I just get the popup for the delete and then the very user-unfriendly Oracle error, almost as if the validation wasn't there. I tried removing the popup associated with the delete button, but it did not make a difference.
    I want to provide a friendly intercept and return. I do not want to cascade the delete. What am I missing here?
    Thanks.
    Gillian

    Thanks Varad, by running the debug, I realized I misinterpreted what the validation did - I had used EXISTS instead of NOT EXISTS. Making this change resulted in the correct processing. Being a newbie, I wasn't sufficiently familiar with the debug option to think about it.

  • Consolidator Exception: ORA-02291

    We have Olite 10g R2 on a Windows 2003 5.2 Operating system. We packaged an application and published it to the Mobile Server. When we attempt to assign access to a user or a group we are getting a VIRTUAL PATH IS NULL error. Even though we get this error it still shows the user or group as having access on the APPLICATION: ACCESS table. When we attempt to set the ROLES for the USER or GROUP we then get the following error.
    Error in executing “ Save application “:oracle.lite.web.resource.ResourceException: CONS-10049: Consolidator Exception: ORA-02291: integrity constraint (MOBILEADMIN.C$ALL_CLIENT_ITEMSFK) violated – parent key not found
    The 10.2.0.2.0 patchset has been applied. We are still getting both of these errors. Is there another patch that is required? Need some help.

    When you publish an application data is created in the mobileadmin repository schema
    C$ALL_PUBLICATIONS will contain one record for each publication item you create (plus a few pre-loaded default ones). The record includes the select statement used to define the snapshot for the publication item, so if this is for an object with a lot of columns or a complex select statement it can result in a large record. From this error is looks like the table space definition is too small.
    You need to talk to your DBAs about getting this increased. If it is too small as well as problems with the publish, the MGP process may fail as well as by default the CFM$ inqueue and CMP$ out queue tables also get created in this tablespace

  • How to find the table name on which integrity constraint not found

    Hi All
    How to acheive this
    I have a lot of tables with lot of primary key - foreign key
    relationship.
    In plsql
    when any inserts happen in the child table & the corresponding row is not present in the parent table, we get an exception
    ORA-02291: integrity constraint (user1.ppk) violated - parent key not found
    On this exception , in the exception block i want to trap teh name of the parent table on which the primary key for the particular child table was not there
    Is it possible to retrieve the parent table in this way. I am looking for a generic plsql code block which can help to acheive this
    Regards

    scott@ORA92> SET SERVEROUTPUT ON
    scott@ORA92> DECLARE
      2    e_no_parent_key EXCEPTION;
      3    PRAGMA            EXCEPTION_INIT (e_no_parent_key, -2291);
      4    v_fk_cons       VARCHAR2 (61);
      5    v_owner            VARCHAR2 (30);
      6    v_parent_table  VARCHAR2 (61);
      7    v_pk_cons       VARCHAR2 (30);
      8    v_parent_column VARCHAR2 (30);
      9  BEGIN
    10    INSERT INTO emp (empno, deptno) VALUES (99, 60);
    11  EXCEPTION
    12    WHEN e_no_parent_key THEN
    13        -- extract schema.constraint_name from sqlerrm:
    14        v_fk_cons:= SUBSTR (SQLERRM,
    15                      INSTR (SQLERRM, '(') + 1,
    16                      INSTR (SQLERRM, ')') - (INSTR (SQLERRM, '(') + 1));
    17        DBMS_OUTPUT.PUT_LINE ('Foreign key constraint violated: ' || v_fk_cons);
    18        -- extract parent schema.table and parent key:
    19        SELECT owner, table_name, constraint_name
    20        INTO     v_owner, v_parent_table, v_pk_cons
    21        FROM     user_constraints
    22        WHERE     (owner, constraint_name) =
    23            (SELECT r_owner, r_constraint_name
    24             FROM     user_constraints
    25             WHERE     owner || '.' || constraint_name = v_fk_cons);
    26        DBMS_OUTPUT.PUT_LINE ('Parent table: ' || v_owner || '.' || v_parent_table);
    27        DBMS_OUTPUT.PUT_LINE ('Parent key: ' || v_owner || '.' || v_pk_cons);
    28        -- extract parent table columns:
    29        FOR rec IN
    30          (SELECT column_name
    31           FROM   user_cons_columns
    32           WHERE  owner = v_owner
    33           AND    table_name = v_parent_table
    34           AND    constraint_name = v_pk_cons)
    35        LOOP
    36          DBMS_OUTPUT.PUT_LINE
    37            ('Parent table column: ' || rec.column_name);
    38        END LOOP;
    39  END;
    40  /
    Foreign key constraint violated: SCOTT.FK_DEPTNO
    Parent table: SCOTT.DEPT
    Parent key: SCOTT.PK_DEPT
    Parent table column: DEPTNO
    PL/SQL procedure successfully completed.

  • ORA-02291 - ORA-02063 on merge with dml error logging through DB link

    Hello all,
    I have 2 DB's and I would like to merge records from A into B with dml error logging through a db link.
    Exemple:
    merge into B@dblink
    using (select ... from A where...)
    when matched then
    when not matched then
    log errors into err$_A reject limit unlimited;
    When I use this, and exception is thrown:
    ORA-02291: integrity constraint (B.constraint_name) violated - parent key not found
    ORA-02063: preceding line from dblink
    I've got no idea of what causes this.
    Could anyone please help me ?
    Thanks !
    Regards,
    TDE.

    Hello damorgan,
    Thanks for your answer.
    I've well understood that its was a foreign key violation, and I guess that's an error in the source: wee make only logical deletes, and I'm quite sure the problem is there.
    Anyway, I really would understand why dml error logging doesn't work in this case.
    I'll investigate and keep you informed.
    Regards.

  • Error Handling for ORA-02291

    Dear all,
    please help me, what exception name i must use
    (like "NO_DATA_FOUND" or "DUP_VAL_ON_INDEX") for error handling
    (exception) for ORA-02291 : integrity constraint(....) violated -
    parent key not found.
    Thank you.
    Regards
    Teguh Santoso

    Find out the error no. Oracle returns for this error & in the
    front-end (Ex:Forms) create a Pragma Exception error handler &
    give ur user defined error message when the user encounters
    it....
    Hope this suffices.
    Santhosh

  • ORA-02291 during MERGE on self-referenced table

    Hello,
    I encountered error ORA-02291 when I tried to use MERGE statement on the table with "self-referenced" foreign key. Using the foreign key deferrable did not help. The only one thing, which helped me, was using errorlog table. See the demonstration:
    Working as common user:
    SQL> CONNECT scott/tiger
    First of all, I create table and (not deferrable) constraints:
    CREATE TABLE fkv (
         id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
         parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    INSERT is working well:
    INSERT INTO fkv (
         id,
         parent_id
    SELECT
    1,
    1
    FROM
    DUAL;
    COMMIT;
    1 rows inserted.
    commited.
    MERGE statement using UPDATE branch is working well too:
    MERGE INTO fkv USING (
    SELECT
    1 AS ID,
    1 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    COMMIT;                                        
    1 rows merged.
    commited.
    And now is coming the strange behaviour:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    SQL Error: ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ROLLBACK;
    rollback complete.
    Ok, even it is not a good solution, I try deferrable constraint:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(id) DEFERRABLE INITIALLY DEFERRED;
    table FKV altered.
    table FKV altered.
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID);
    1 rows merged.
    COMMIT;
    SQL Error: ORA-02091: transaction rolled back
    ORA-02291: integrity constraint (SCOTT.FK_FKV_PAID) violated - parent key not found
    ... deffered constraint did not help :-(
    Let's try another way - errorlog table; for the first with the not deferrable constraint again:
    ALTER TABLE fkv DROP CONSTRAINT fk_fkv_paid;
    ALTER TABLE fkv ADD CONSTRAINT fk_fkv_paid FOREIGN KEY (parent_id) REFERENCES fkv(ID) NOT DEFERRABLE;
    table FKV altered.
    table FKV altered.
    BEGIN
    sys.dbms_errlog.create_error_log (
    dml_table_name => 'FKV',
    err_log_table_name => 'ERR$_FKV'
    END;
    anonymous block completed
    Toys are prepared, let's start with error logging:
    MERGE INTO fkv USING (
    SELECT
    2 AS id,
    2 AS PARENT_ID
    FROM
    DUAL
    ) a
    ON (
    fkv.id = a.id
    WHEN MATCHED THEN
    UPDATE SET
    fkv.parent_id = a.parent_id
    WHERE
    A.ID IS NOT NULL
    DELETE WHERE a.id IS NULL
    WHEN NOT MATCHED THEN
    INSERT (
    ID,
    parent_id
    VALUES (
    A.ID,
    A.PARENT_ID)
    LOG ERRORS INTO err$_fkv;
    1 rows merged.
    Cannot belive, running SELECT for confirmation:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Ok, COMMIT:
    COMMIT;
    commited.
    SELECT for confirmation again:
    SELECT * FROM err$_fkv;                    
    SELECT * FROM fkv;
    no rows selected
    ID PARENT_ID
    1 1
    2 2
    Using deffered constraint and error logging is working well too.
    Metalink and Google did not help me. I am using databases 10.2.0.5 and 11.2.0.3.
    Has somebody encountered this problem too or have I missed something?
    Thank you
    D.

    drop table fkv;
    CREATE TABLE fkv (
    id NUMBER(1) CONSTRAINT nn_fkv_id NOT NULL,
    parent_id NUMBER(1) CONSTRAINT nn_fkv_paid NOT NULL
    CREATE INDEX PK_FKV_ID ON FKV(ID);
    ALTER TABLE fkv ADD CONSTRAINT pk_fkv_id PRIMARY KEY (id);
    ALTER TABLE FKV ADD CONSTRAINT FK_FKV_PAID FOREIGN KEY (PARENT_ID) REFERENCES FKV(ID);Now run your MERGE statement and it works with non deferrable constraints.
    Personally, I would contact support about this before depending on it in production.
    P.S. I was not able to reproduce your findings that dropping and re-adding the constraints changes things. I suspect that when you dropped the constraint the index was NOT dropped, so you kept a non-unique index.
    Try again using ALTER TABLE FKV DROP CONSTRAINT PK_FKV_ID drop index;

  • Users getting APP-FND-01934:ora-00001 unique constraint

    users getting APP-FND-01934:ora-00001 unique constraint(ENI.ENI_OLTP_ITEM_STAR_U3) violated in package ENI_ITEMS_STAR_PKG Procedure INsERT_ITEMS_IN_STAR on Master ITEM's in 11i EBS.

    Please see these MOS Docs.
    APP-FND-01934 ORA-00001 Error Occurs When Creating Items [ID 1072935.1]
    APP-FND-01934 ORA-00001: Unique Constraint Error at Master Items [ID 465008.1]
    ORA-02291: Integrity Constraint (GMI.IC_LOTS_MST_IC_ITEM_MST_B_FK) Violated [ID 302368.1]
    Thanks,
    Hussein

  • Integrity constraints error

    Hi:
    i am trying to insert records into two tables from a jsp page,
    table A and table B. the column A1 is foregin key for table B.
    whe i execute the add method it does the isert successfully for
    table A but gives error for table B. this si the error i get:
    "ORA-02291:Integrity constraint violeted: parent key not found"
    should the insert statement in table A be committed before the
    insert on table B is executed? fi so please tell me how to do
    that. and if not please give me some suggestion. thank you.

    The following works for me (11gR2)...
    create or replace type OTester
    is object
        id    integer
    Type created.
    create
    table    Tester_Object
    of    OTester
        primary key (id)
    object identifier is primary key
    Table created.
    create
    table    Tester_Object_2
    of    OTester
        primary key (id)
    object identifier is primary key
    Table created.
    create
    table    Tester_Reference
        tester    ref OTester    scope is Tester_Object
    Table created.
    create
    index    IN_Tester_Reference
    on    Tester_Reference
        tester
    Index created.
    alter
    table    Tester_Reference
    add    (
        foreign key (tester) references Tester_Object on delete cascade
    Table altered.
    insert
    into    Tester_Object
    values    (
        OTester(1)
    1 row created.
    select    o.*
    from    Tester_Object o
            ID
             1
    1 row selected.
    insert
    into    Tester_Reference
    select    ref(o)
    from    Tester_Object o
    1 row created.
    select    r.*
    from    Tester_Reference r
    TESTER                                          
    00004A038A0046876B2B6FC9014CDBAAC357A4FEDBA5D40000
    001426010001000100290000000000090626002A00078401FE
    0000000A02C102000000000000000000000000000000000000
    0000                                            
    1 row selected.
    delete
    from    Tester_Object
    1 row deleted.
    select    o.*
    from    Tester_Object o
    no rows selected.
    select    r.*
    from    Tester_Reference r
    no rows selected.
    insert
    into    Tester_Object_2
    values    (
        OTester(2)
    1 row created.
    select    o.*
    from    Tester_Object_2 o
            ID
             2
    1 row selected.
    insert
    into    Tester_Reference
    select    ref(o)
    from    Tester_Object_2 o
    Error at line 136
    ORA-22819: scope of input value does not correspond to the scope of the target
    Please post code describing your own situation if this is not working for you.
    Gerard

  • Apex 4.0 import error - integrity constraint (APEX_040000.WWV_FLOWS_FK)

    I have a new Oracle Express 10G instance with Application Express 4.0 installed on it. I am trying to import an existing application that has been exported using Application Express. I get this error. How do I fix this?
    SQL> connect apex_040000/xxxxxxxxx
    Connected.
    SQL> show user
    USER is "APEX_040000"
    SQL> @C:\apex_misc\f41362_app_export_092010.sql
    APPLICATION 41362 - REQ Tracker
    Set Credentials...
    Check Compatibility...
    API Last Extended:20100513
    Your Current Version:20100513
    This import is compatible with version: 20100513
    COMPATIBLE (You should be able to run this import without issues.)
    Set Application ID...
    begin
    ERROR at line 1:
    ORA-02291: integrity constraint (APEX_040000.WWV_FLOWS_FK) violated - parent
    key not found
    ORA-06512: at "APEX_040000.WWV_FLOW_API", line 621
    ORA-06512: at line 3
    Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Produ
    ction

    Hi,
    as you say your Apex instance is new - does the workspace you exported the application from exist on your new apex instance? Probably not. You could try to set the appropriate one using the API like this:
    exec wwv_flow_api.set_security_group_id(p_security_group_id => apex_util.find_security_group_id(p_workspace => 'XYZ'));This still requires that you already have created the workspace.
    Is there a reason why you don't import the application with the workspace import?
    -Udo

  • Import error: ORA-00001:unique constraint (FLOWS_030100.WWV_FLOW_FLOW_PK)

    Hi community,
    I got an awful application import error.
    ORA-20001: GET_BLOCK Error. ORA-20001: GET_STMT error. ORA-20001: Execution of the statement was unsuccessful. ORA-00001: unique constraint (FLOWS_030100.WWV_FLOW_FLOW_PK) violated &amp;lt;pre&amp;gt;--application/create_application &amp;amp;lt;br&amp;amp;gt; &amp;amp;lt;br&amp;amp;gt;begin &amp;amp;lt;br&amp;amp;gt; &amp;amp;lt;br&amp;amp;gt;wwv_flow_api.create_flow( &amp;amp;lt;br&amp;amp;gt; p_id =&amp;amp;gt; 381, &amp;amp;lt;br&amp;amp;gt; p_display_id=&amp;amp;gt; 381, &amp;amp;lt;br&amp;amp
    Error installing application.What did I do?
    Developed some in my test environment (APP ID 381) and made a normal export like 100 times before. When I tried to import that application in APP ID 380 the error occurred.
    More information:
    Both applications are in the same workspace.
    APEX 3.1.2
    Oracle XE
    I tried a bit around:
    Import in another workspace > same error
    Restart OAS try to import> same error
    Deletion of APP 380 and the try to import > same error
    Import of an older version > successfully no errors
    Try to make a new export of APP ID 381 > same error on import
    Don't want to delete app 381! :O
    Seems like something inside of the application/export is wrong.

    Hi Scott,
    the query returns
    select grantee from dba_role_privs where granted_role='APEX_ADMINISTRATOR_ROLE';
    GRANTEE
    SYSI tried to install the export in another apex database environment. New error occurred.
    ORA-20001: GET_BLOCK Error.
    ORA-20001: Execution of the statement was unsuccessful.
    ORA-02291: integrity constraint
    (FLOWS_030100.WWV_FLOW_SEC_SCHEMES_FK) violated - parent key not found &lt;pre&gt;begin
    --application/shared_components/security/authorization/t_users
    wwv_flow_api.create_security_scheme( p_id =&amp;gt; 18109134549712168 + wwv_flow_api.g_id_offset, p_flow_id =&amp;gt;
    wwv_flow.g_flow_id, p_name=&amp;gt;'T_USERS', p_scheme_type=&amp;gt;'EXISTS', p_scheme=&amp;gt;'select cI looked in the export file for the error part and found some interesting code. See:
    prompt  ...authorization schemes
    begin
    --application/shared_components/security/authorization/t_users
    wwv_flow_api.create_security_scheme(
      p_id => 18109134549712168 + wwv_flow_api.g_id_offset,
      p_flow_id => wwv_flow.g_flow_id,
      p_name=>'T_USERS',
      p_scheme_type=>'EXISTS',
      p_scheme=>'select count(*) from v_mze_appl '||chr(10)||
    'where NAME like UPPER(:P101_USERNAME)'||chr(10)||
    'and ROLE IN (''APEX_MZE_ADMIN'',''APEX_MZE_USERS'')'||chr(10)||
      p_caching=>'BY_USER_BY_PAGE_VIEW',
      p_error_message=>'Sie haben keine Berechtigungen für diese Seite');
    --application/shared_components/security/authorization/t_auswertung
    wwv_flow_api.create_security_scheme(
      p_id => 42071873141249964 + wwv_flow_api.g_id_offset,
      p_flow_id => wwv_flow.g_flow_id,
      p_name=>'T_AUSWERTUNG',
      p_scheme_type=>'EXISTS',
      p_scheme=>'select count(*) from v_mze_appl '||chr(10)||
    'where NAME like UPPER(:P101_USERNAME)'||chr(10)||
    'and ROLE IN (''APEX_MZE_ADMIN'',''APEX_MZE_REPORT'')'||chr(10)||
      p_caching=>'BY_USER_BY_PAGE_VIEW',
      p_error_message=>'No rights for the page');
    --application/shared_components/security/authorization/t_berechtigungen
    wwv_flow_api.create_security_scheme(
      p_id => 42072157819264447 + wwv_flow_api.g_id_offset,
      p_flow_id => wwv_flow.g_flow_id,
      p_name=>'T_BERECHTIGUNGEN',
      p_scheme_type=>'EXISTS',
      p_scheme=>'select count(*) from v_mze_appl '||chr(10)||
    'where NAME like UPPER(:P101_USERNAME)'||chr(10)||
    'and ROLE IN (''APEX_MZE_ADMIN'',''APEX_MZE_BERECHTIGUNGEN'')'||chr(10)||
      p_caching=>'BY_USER_BY_PAGE_VIEW',
      p_error_message=>'No rights for the page');
    --application/shared_components/security/authorization/t_kategorien
    wwv_flow_api.create_security_scheme(
      p_id => 42072262321265732 + wwv_flow_api.g_id_offset,
      p_flow_id => wwv_flow.g_flow_id,
      p_name=>'T_KATEGORIEN',
      p_scheme_type=>'EXISTS',
      p_scheme=>'select count(*) from v_mze_appl '||chr(10)||
    'where NAME like UPPER(:P101_USERNAME)'||chr(10)||
    'and ROLE IN (''APEX_MZE_ADMIN'',''APEX_MZE_KATEGORIEN'')',
      p_caching=>'BY_USER_BY_PAGE_VIEW',
      p_error_message=>'No rights for the page');
    end;
    /Looks like the p_id for T_USERS is wrong. Exactly what the error tries to describe too. How could that happen and how can I solve that issue? I will try and save the t_users group again and will create a new export.
    King regards,
    Tobias
    Edited by: Tobias Arnhold on Mar 2, 2009 8:23 AM

  • ORA-01843 and ORA-02291 when installing AIA 2.0 on Linux server

    Hello,
    When installing AIA 2.0 on a RHEL 4.7 Linux server, even if OUI does say the installion is successful, the installActions log are not that good...
    We've got some ORA-01843 and ORA-02291 errors when running the createDiagnosticsCAVSData.sql.
    [exec] createBSRIntegScenarioTables:
    [exec] [echo] ----Creating createCAVSTables--------------
    [exec] [sql] Executing resource: /exec/applis/tbaia/products/AIA/seeddata/DatabaseObjects/createBSRIntegScenarioTables.sql
    [exec] [sql] 152 of 152 SQL statements executed successfully
    [exec]
    [exec] createDiagnosticsCAVSData:
    [exec] [echo] ----Creating createCAVSTables--------------
    [exec] [sql] Executing resource: /exec/applis/tbaia/products/AIA/seeddata/DatabaseObjects/createDiagnosticsCAVSData.sql
    [exec] [sql] Failed to execute: Insert into CAVS_DEFINITIONS (DEFINITION_ID,TYPE,DESCRIPTION,STATE,SERVICE_TYPE,URL_WSDL,URL_ENDPOINT,SOAP_ACTION,SOAP_TRANSPORT_TYPE,MESSAGE_REQUEST,MESSAGE_RESPONSE,DELAY,VERSION,PROJECT_NAME,PROJECT_VERSION,EBS_NAME,EBS_VERSION,PROCESS_NAME,PROCESS_VERSION,SERVICE_NAME,SERVICE_VERSION,MESSAGE_NAME,MESSAGE_VERSION,PIP_NAME,PIP_VERSION,APPLICATION_NAME,APPLICATION_VERSION,TEST_PRIORITY,REFERENCE_ID_EXTERNAL,AUDITED_ON,AUDITED_BY) values (501,'Test','BPEL Transformation Diagnostics','Unlocked','Synchronous',null,'http://dvedvb40:7777/orabpel/default/AIADiagnosticsTransformBpelProcess/1.0','process','HTTP','<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://xmlns.oracle.com/BRM/schemas/BusinessOpcodes"> <ns1:PCM_OP_BILL_DEBIT_inputFlist> <ns1:BAL_GRP_OBJ>Test</ns1:BAL_GRP_OBJ> <ns1:DEBIT elem="523"> <ns1:BAL_OPERAND>1000</ns1:BAL_OPERAND> <ns1:TYPE>881</ns1:TYPE> </ns1:DEBIT> <ns1:DESCR>Sample Input</ns1:DESCR> <ns1:END_T>2007-07-31T12:00:00.000+5:30</ns1:END_T> <ns1:POID>A123</ns1:POID> <ns1:PROGRAM_NAME>100</ns1:PROGRAM_NAME> <ns1:SERVICE_OBJ>NA</ns1:SERVICE_OBJ> <ns1:SESSION_OBJ>NA</ns1:SESSION_OBJ> <ns1:START_T>2007-07-31T11:00:00.000+5:30</ns1:START_T> <ns1:STR_VERSION>527</ns1:STR_VERSION> <ns1:STRING_ID>528</ns1:STRING_ID> <ns1:SUB_BALANCES elem="530"> <ns1:CONTRIBUTOR_STR>Diagnostics</ns1:CONTRIBUTOR_STR> <ns1:ROLLOVER_DATA>1</ns1:ROLLOVER_DATA> <ns1:VALID_FROM>2007-07-31T11:00:00.000+5:30</ns1:VALID_FROM> <ns1:VALID_TO>2007-07-31T11:00:00.000+5:30</ns1:VALID_TO> </ns1:SUB_BALANCES> </ns1:PCM_OP_BILL_DEBIT_inputFlist> </soap:Body> </soap:Envelope>','<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header/> <env:Body> <PCM_OP_BILL_DEBIT_outputFlist xmlns:ns0="http://xmlns.oracle.com/BRM/schemas/BusinessOpcodes" xmlns="http://xmlns.oracle.com/BRM/schemas/BusinessOpcodes"> <ns0:POID>Transformed POID value : A123</ns0:POID> <ns0:RESULTS elem="Transformed Element value : 523"/> </PCM_OP_BILL_DEBIT_outputFlist> </env:Body> </env:Envelope>',null,0,null,null,null,null,'Diagnostics Transformation',null,'DiagTransformationBPEL','1.0',null,null,'AIA Diagnostics',null,null,null,null,null,to_date('01-OCT-07','DD-MON-RR'),'oc4jadmin')
    [exec] [sql] java.sql.SQLException: ORA-01843: not a valid month
    [exec] [sql] Failed to execute: Insert into CAVS_DEFINITION_NSXPATHS (DEFINITION_ID,NAMESPACE_ALIAS,NAMESPACE) values (501,'env','http://schemas.xmlsoap.org/soap/envelope/')
    [exec] [sql] java.sql.SQLException: ORA-02291: integrity constraint (AIA.DEFINITION_NSXPATHS_D_FK) violated - parent key not found
    [exec] [sql] *1 of 43 SQL statements executed successfully*
    Any advice to solve this issue?
    Thanks in advance.
    Regards,
    K.
    Edited by: KaRiNe_Fr on 3 juin 2009 01:55 createDiagnosticsCAVSData.sql instead of createBSRIntegScenarioTables.sql...

    Hello,
    me again...
    Is this table CAVS_DEFINITIONS important to be populated for the rest of the AIA installation?
    The installation keeps on failing and it is a real issue for us...
    If of any use, here are some results from SQL requests onto our AIA database:
    SQL> SELECT * FROM NLS_DATABASE_PARAMETERS ;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET WE8ISO8859P15
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD.MM.YYYY
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 10.2.0.4.0
    20 rows selected.
    SQL> select to_date('01-OCT-07','DD-MON-RR') from dual;
    TO_DATE('
    01-OCT-07
    Regards,
    KaRiNe.
    Edited by: KaRiNe_Fr on 3 juin 2009 01:59

  • Error while crreate variable in New work repository -- integrity constraint

    Hi,
    I had created new Master and work reposiotry with new Internal ID's.
    I am able to import project, variables.
    while creating new variable I am getting below error.
    java.sql.BatchUpdateException: ORA-02291: integrity constraint (SNPW.FK_TXT) violated - parent key not found
    Could any one got this error before
    Is there any steps I missed. -- Any help is Appreciatied.

    Hi,
    Table SNP_TXT in your work repository has a foreign key reference with table SNP_ORIG_TXT
    on column I_TXT_ORIG,
    while you are inserting a new variable for the project etc, it is getting inserted in SNP_TXT
    before insertion it is checking the I_TXT_ORIG value with the table SNP_ORIG_TXT .
    Please do select on these tables in your old repository and your new repository.
    and let me know.
    Reshma

  • Master-Details form - integrity constraint

    Hi,
    I have created a simple master-detail form. Master block is based on say Table1 with 2 columns and detail block is based on Table2 with 4 columns.
    When I am trying to create records using this form, I enter data in the Master block and then navigate to the detail block and then enter data. When I press the save button,
    the form throws error message "ORA-02291: integrity constraint (APPS.FK_RECORD_IDENTIFIER) violated - parent key not found"
    When I check the query using Help->Diagnostics->display database error, the insert statement is insert into table2 values (......
    I guess, the form is trying to insert data into table2 first. Since there is no corresponding entry in Table1, hence the error. What should be done, so that the form inserts Master block data into table1 first before attempting to insert data into detail block.
    Regards
    Suresh

    Suresh,
    In the Object Navigator view, check the block order under the Data Blocks section. The Master Block should come first, and then only the detail should come. If its is not like that, then change the order of the blocks by dragging the master block to top of the blocks.
    Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

Maybe you are looking for