You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Ravi P Palacherla (JIRA)" <ji...@apache.org> on 2009/05/13 13:16:45 UTC

[jira] Created: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

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
            Reporter: Ravi P Palacherla




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by Jeremy Bauer <te...@gmail.com>.
Thanks, Ravi.  If you have some time to review the fix, that'd be great.
The test was failing on HSQLDB as well as Oracle.  With the fix, it passes
on both DBs.

-Jeremy

On Wed, Nov 4, 2009 at 1:18 PM, Ravi Palacherla
<ra...@oracle.com>wrote:

> Jeremy.
>
> Looks like you already have a fix for multi-column keys.
> Please let me know if you need anything from me.
>
> Thanks,
> Ravi.
>
> -----Original Message-----
> From: Jeremy Bauer (JIRA) [mailto:jira@apache.org]
> Sent: Tuesday, November 03, 2009 3:39 PM
> To: dev@openjpa.apache.org
> Subject: [jira] Commented: (OPENJPA-1083)
> org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions
> ORA-00904 and ORA-02275 against oracleDB.
>
>
>    [
> https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773252#action_12773252]
>
> Jeremy Bauer commented on OPENJPA-1083:
> ---------------------------------------
>
> I've been working on an Oracle test
> failure(TestRelationFieldAsPrimaryKeyAndForeignKey.testQuery) in trunk that
> is identical to this issue.  I thought this fix would have corrected the
> problem, but I discovered that the fix works great for single column foreign
> keys, but does not work with multi-column keys.  I have an addendum to the
> original fix that I'll be committing to trunk shortly.
>
> > 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-M2
> >            Reporter: Ravi P Palacherla
> >            Assignee: Michael Dick
> >             Fix For: 1.3.0, 2.0.0-M3
> >
> >         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch,
> OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
> >
> >
>
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

RE: [jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by Ravi Palacherla <ra...@oracle.com>.
Jeremy.

Looks like you already have a fix for multi-column keys.
Please let me know if you need anything from me.

Thanks,
Ravi.

-----Original Message-----
From: Jeremy Bauer (JIRA) [mailto:jira@apache.org] 
Sent: Tuesday, November 03, 2009 3:39 PM
To: dev@openjpa.apache.org
Subject: [jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.


    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773252#action_12773252 ] 

Jeremy Bauer commented on OPENJPA-1083:
---------------------------------------

I've been working on an Oracle test failure(TestRelationFieldAsPrimaryKeyAndForeignKey.testQuery) in trunk that is identical to this issue.  I thought this fix would have corrected the problem, but I discovered that the fix works great for single column foreign keys, but does not work with multi-column keys.  I have an addendum to the original fix that I'll be committing to trunk shortly.

> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0-M3
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick resolved OPENJPA-1083.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0
                   1.3.0

Thanks for the patch Ravi. I did a little cleanup for compiler warnings and formatting - nothing major. 

> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717248#action_12717248 ] 

Ravi P Palacherla commented on OPENJPA-1083:
--------------------------------------------

Hi Milosz,

The bug you mentioned exists even before the fix for this JIRA went in.

The cause of the issue is inside DBDictionary.getDropForeignKeySQL() where it tries to use DROP constraint instead of DROP FK.

The reason for why this issue appears now is because before the fix for this JIRA , getDropForeignKeySQL() was never called.

The fix in this JIRA makes sure that the FKs are dropped properly before clearing table contents and hence you are seeing this issue now.

So, I guess a new JIRA would be appropriate to fix the issue. Please let me know if you think otherwise.

Also we may have to make getDropPrimaryKeySQL()  consistent with getDropForeignKeySQL().

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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708886#action_12708886 ] 

Ravi P Palacherla commented on OPENJPA-1083:
--------------------------------------------

TestEJBState  fails with  ORA-00904 .

After applying the patch on OPENJPA-946 , ORA-00904 is fixed and now I get the following exception:

"Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-02275: such a referential constrai
nt already exists in the table
 {stmnt 25798515 ALTER TABLE DEPFIELDPC ADD FOREIGN KEY (OWNER_ID) REFERENCES DEPFIELDPC (ID) DEFERR
ABLE} [code=2275, state=42000]"

> 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
>            Reporter: Ravi P Palacherla
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714388#action_12714388 ] 

Milosz Tylenda commented on OPENJPA-1083:
-----------------------------------------

Hi Ravi & Mike,

Just wondering whether we need to modify the regex in TestParentChild to account for an optional "DEFFERABLE" clause? The syntax can be seen in the first comment to this issue. I remember failures of this tests, OracleDictionary has supportsDeferredConstraints = true. Is this test passing for you?


> 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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717248#action_12717248 ] 

Ravi P Palacherla edited comment on OPENJPA-1083 at 6/8/09 6:35 AM:
--------------------------------------------------------------------

Hi Milosz,

The bug you mentioned exists even before the fix for this JIRA went in.

The cause of the issue is inside DBDictionary.getDropForeignKeySQL() where it tries to use DROP constraint instead of DROP FK.

The reason for why this issue appears now is because before the fix for this JIRA , getDropForeignKeySQL() was not dropping the foreignkey if FK name is null.

The fix in this JIRA makes sure that the FKs are dropped properly before clearing table contents and hence you are seeing this issue now.

So, I guess a new JIRA would be appropriate to fix the issue. Please let me know if you think otherwise.

Also we may have to make getDropPrimaryKeySQL()  consistent with getDropForeignKeySQL().

Regards,
Ravi.


      was (Author: rpalache):
    Hi Milosz,

The bug you mentioned exists even before the fix for this JIRA went in.

The cause of the issue is inside DBDictionary.getDropForeignKeySQL() where it tries to use DROP constraint instead of DROP FK.

The reason for why this issue appears now is because before the fix for this JIRA , getDropForeignKeySQL() was never called.

The fix in this JIRA makes sure that the FKs are dropped properly before clearing table contents and hence you are seeing this issue now.

So, I guess a new JIRA would be appropriate to fix the issue. Please let me know if you think otherwise.

Also we may have to make getDropPrimaryKeySQL()  consistent with getDropForeignKeySQL().

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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milosz Tylenda resolved OPENJPA-1083.
-------------------------------------

    Resolution: Fixed

I will open a new issue to deal with MySQL requirements.

> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710812#action_12710812 ] 

Ravi P Palacherla commented on OPENJPA-1083:
--------------------------------------------

Hi Michael,

I spent last couple of days on this issue and came up with a solution as described in #1 in my previous comment.
That is to retrieve the FK name from DB while deleting the FK constraint.
Even though this solution works fine it could be costly as it involves going to DB to fetch the FK name.
So I am still researching on a less expensive solution.

Can you commit my attached changes on this JIRA as it fixes the testcase and I will open a new JIRA to handle the actual foreign key issue.

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
>            Assignee: Michael Dick
>         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.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713995#action_12713995 ] 

Michael Dick commented on OPENJPA-1083:
---------------------------------------

Some comments on the patch for option 1. 

It seems like the logic to obtain the foreign key name from the database belongs in the ForeignKey or Constraint class. Adding a method called loadName() or something similar seems cleaner. 

That being said it's not obvious where we read the name from the database. 

I also noticed that the patch always removes the FK from localTable (DBDictionary.getDropForeignKeySQL) but only adds it if it wasn't found. 

The last suggestion I'd make is to add some sort of unit test just for this change. I know it shows up in other testcases on Oracle, but it'd be nice to just validate this part of the change. 

> 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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713559#action_12713559 ] 

Michael Dick commented on OPENJPA-1083:
---------------------------------------

Hi Ravi,

I prefer option 1. It shouldn't affect existing tables (say if you migrate from 1.2 to 2.0) and it should work with your testcase.

> 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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1083:
----------------------------------

    Fix Version/s:     (was: 2.0.0)
                   2.0.0-M3

> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0-M3
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714449#action_12714449 ] 

Ravi P Palacherla commented on OPENJPA-1083:
--------------------------------------------

Hi,

Thanks for your comments.

It is supposed to be handled as part of
http://issues.apache.org/jira/browse/OPENJPA-907

There is a patch attached to it (I was a bit liberal with the RegEx).
I will correct it and ask for commiting the patch, once I am done with this.

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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773252#action_12773252 ] 

Jeremy Bauer commented on OPENJPA-1083:
---------------------------------------

I've been working on an Oracle test failure(TestRelationFieldAsPrimaryKeyAndForeignKey.testQuery) in trunk that is identical to this issue.  I thought this fix would have corrected the problem, but I discovered that the fix works great for single column foreign keys, but does not work with multi-column keys.  I have an addendum to the original fix that I'll be committing to trunk shortly.

> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0-M3
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ravi P Palacherla updated OPENJPA-1083:
---------------------------------------

    Attachment: OPENJPA-1083_option2.patch
                OPENJPA-1083_option1.patch

Hi Michael, 

option#1 and option#2 patches are uploaded.
You do not need both patches, either one of them should work.

TestEJBState will work only with patch OPENJPA-946 and the current patch.
My current patch handles the foreign key problem.

option#1 :
Every time I try to delete a FK, I will check the FKname.
If it does not exist then I go to DB and fetch the FKName.

If option#1 is not preferable for any reason then you can try option2.

option#2 :
Every time I try to add a FK. 
I will check in the Mappings if FKName exists.
If it does not exist then a default name will be given.
The default name is local table name + column name of FK.

The only issue with option#2 is that it will work on a new clean database.
So running "mvn clean test -DfailIfNoTests=false" will run fine with out any issues.

If the tables are already created then it will not work because openJPA will think that the default name FK 
is new FK and will try to add the existing FK with the new default name.

I think it is an existing issue, same behavior for columns , tables etc...

Please let me know if option#2 is preferable, but my changes are not acceptable because it does not work with existing database. I can add the logic of making it work on existing database also.

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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milosz Tylenda reopened OPENJPA-1083:
-------------------------------------


I am afraid the change causes a crash with MySQL:

<openjpa-2.0.0-SNAPSHOT-r422266:782132 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT DEPFIELDPC_ibfk_1' at line 1 {stmnt 15864952 ALTER TABLE DEPFIELDPC DROP CONSTRAINT DEPFIELDPC_ibfk_1} [code=1064, state=42000]
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:553)
[...]

Probably MySQL requires DROP FOREIGN KEY instead of DROP CONSTRAINT.

Other databases should also be checked.


> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709486#action_12709486 ] 

Michael Dick commented on OPENJPA-1083:
---------------------------------------

Hi Ravi,

I think there's a larger problem here. We're able to create a FK without a name but unable to remove one. The relevant methods are getDropForeignKeySQL and getForeignKeyConstraintSQL().. 

Either it should be impossible to have an unnamed FK constraint when we call getDropFKSQL or we need to make those two methods consistent.. 

As far as the patch goes the approach will work for the getDeleteTableContentsSQL method, but we may still have a (potentially) larger problem to solve. 

> 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
>            Assignee: Michael Dick
>         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.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717216#action_12717216 ] 

Milosz Tylenda commented on OPENJPA-1083:
-----------------------------------------

I have checked the latest docs of DB2, Derby, Firebird, MySQL, Oracle, PostgreSQL, SQL Server and Sybase 11and it seems that only MySQL does not like DROP CONSTRAINT and needs DROP FOREIGN KEY key_name.

Maybe this issue could be closed and a new one created for updating MySQL dictionary.

Since MySQL does not understand DROP CONSTRAINT at all, we might also need to override getDropPrimaryKeySQL. On the other hand, getDropPrimaryKeySQL seems not to be used with PK name != null. Is there a way for an application to specify PK constraint name?




> 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-M2
>            Reporter: Ravi P Palacherla
>            Assignee: Michael Dick
>             Fix For: 1.3.0, 2.0.0
>
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ravi P Palacherla updated OPENJPA-1083:
---------------------------------------

    Attachment: OPENJPA-1083_trunk.patch

Hi Mike,

Attached patch includes all the suggestions in your previous comment.

Major changes:
a. Moved the logic of getting FK name from DB to ForeignKey.java
b. Added a test case to validate loadNameFromDB() of ForeignKey.java
c. My patch( ForeignKey. loadNameFromDB() ) no more removes all the FKs. 
    It will only remove the newly added FK.

Please review it and let me know of any further changes.

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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch, OPENJPA-1083_trunk.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ravi P Palacherla updated OPENJPA-1083:
---------------------------------------

           Patch Info: [Patch Available]
    Affects Version/s: 2.0.0

> 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.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714015#action_12714015 ] 

Michael Dick commented on OPENJPA-1083:
---------------------------------------

Forgot to finish my earlier comment. On the whole this is a good patch and thanks for putting it all together 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
>            Assignee: Michael Dick
>         Attachments: OPENJPA-1083.patch, OPENJPA-1083_option1.patch, OPENJPA-1083_option2.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709526#action_12709526 ] 

Ravi P Palacherla commented on OPENJPA-1083:
--------------------------------------------

Hi Michael,

Thanks a lot for looking into it.

Yes I agree with you, the actual issue is "We're able to create a FK without a name but unable to remove one. "

When trying to add FK with out a name then the DB will use a system generated name.

There are couple of options that I can think of in fixing the issue:
1)
While trying to remove the FK ( getDropForeignKeySQL ) if there is no foreign key name then I will try to get the FK name from DB and use it in the drop FK statement.

2)
While adding a constraint, openJPA should give a default name to constraint, unless already specified by app or testcase.
In this case we may have to handle the duplicate constraint name on a table just like column names.

I will start working on it, unless you have objection with any one of them (or both).

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
>            Assignee: Michael Dick
>         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.


[jira] Updated: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ravi P Palacherla updated OPENJPA-1083:
---------------------------------------

    Attachment: OPENJPA-1083.patch

Attached is a proposed fix.
Please review and commit if it is fine.

Fix for OPENJPA-946  should be applied before applying this fix.

> 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.


[jira] Commented: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708936#action_12708936 ] 

Michael Dick commented on OPENJPA-1083:
---------------------------------------

Ravi, is this something that only happens with Oracle? Or is Oracle is the only database that throws an exception? 

Either way this patch looks like it will work, but I'd like to know why we're getting a duplicate FK relationship. I believe some of the unit tests use similar entities (same table name) - if that's the case then qualifying the table name is a better approach. 

> 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.


[jira] Assigned: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick reassigned OPENJPA-1083:
-------------------------------------

    Assignee: Michael Dick

> 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
>            Assignee: Michael Dick
>         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.


[jira] Issue Comment Edited: (OPENJPA-1083) org.apache.openjpa.persistence.kernel.TestEJBState fails with two exceptions ORA-00904 and ORA-02275 against oracleDB.

Posted by "Ravi P Palacherla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710812#action_12710812 ] 

Ravi P Palacherla edited comment on OPENJPA-1083 at 5/19/09 1:35 PM:
---------------------------------------------------------------------

Hi Michael,

I spent last couple of days on this issue and came up with a solution as described in #1 in my previous comment.
That is to retrieve the FK name from DB while deleting the FK constraint.
Even though this solution works fine it could be costly as it involves going to DB to fetch the FK name.
So I am still researching on a less expensive solution.

Can you commit my attached changes on this JIRA as it fixed the testcase and I will open a new JIRA to handle the actual foreign key issue.

Regards,
Ravi.


      was (Author: rpalache):
    Hi Michael,

I spent last couple of days on this issue and came up with a solution as described in #1 in my previous comment.
That is to retrieve the FK name from DB while deleting the FK constraint.
Even though this solution works fine it could be costly as it involves going to DB to fetch the FK name.
So I am still researching on a less expensive solution.

Can you commit my attached changes on this JIRA as it fixes the testcase and I will open a new JIRA to handle the actual foreign key issue.

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
>            Assignee: Michael Dick
>         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.