[
https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708987#action_12708987
]
Ravi P Palacherla commented on OPENJPA-1083:
--------------------------------------------
Michael,
Thanks a lot for reviewing it.
I think the above exception will occur in any database that will not allow
executing the same SQL statement to add same foreign key more than once.
I tested it against Derby and oracle only.
E.g: If you execute both the following statements (same statement twice)
ALTER TABLE DEPFIELDPC ADD FOREIGN KEY (OWNER_ID) REFERENCES DEPFIELDPC
ALTER TABLE DEPFIELDPC ADD FOREIGN KEY (OWNER_ID) REFERENCES DEPFIELDPC
Execution of above two statement will be successful in Derby ( hence test case
passes in Derby) .
The second statement will fail in oracle with the ORA-02275 exception.
>>Why we are getting duplicate FK ?
In getDeleteTableContentsSQL() of DBDictionary.java,
while trying to delete the contents of table , openJPA tries to
a. remove FK
b. delete rows and then
c. add FK back
When there is no FK name then we are not removing it but still trying to add it.
The attached patch will not add FK unless we remove it.
Please let me know of any suggestions.
Regards,
Ravi.
> org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions
> ORA-00904 and ORA-02275 against oracleDB.
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-1083
> URL: https://issues.apache.org/jira/browse/OPENJPA-1083
> Project: OpenJPA
> Issue Type: Sub-task
> Affects Versions: 2.0.0
> Reporter: Ravi P Palacherla
> Attachments: OPENJPA-1083.patch
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.