You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Craig Russell (JIRA)" <ji...@apache.org> on 2009/07/04 05:54:47 UTC

[jira] Created: (OPENJPA-1159) Bad error message for find of an Entity with compound primary key if parameter of wrong class

Bad error message for find of an Entity with compound primary key if parameter of wrong class
---------------------------------------------------------------------------------------------

                 Key: OPENJPA-1159
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1159
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
            Reporter: Craig Russell
            Assignee: Craig Russell
            Priority: Minor
             Fix For: 2.0.0


Test set: com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.234 sec <<< FAILURE!
test(com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest)  Time elapsed: 4.168 sec  <<< ERROR!
<openjpa-1.2.0-r422266:753657 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: 1
	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1154)
	at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
	at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
	at com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest.test(LongLongStringPKRelationshipTest.java:65)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
	at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve(ApplicationIds.java:602)
	at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.fetchLongField(ApplicationIds.java:578)
	at com.mysql.clusterj.jpatest.model.LongLongStringFKRelationship.pcCopyKeyFieldsToObjectId(LongLongStringFKRelationship.java)
	at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:172)
	at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:218)
	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1141)
	... 30 more

The failure is clearly a user error but the message is bad. The message should say that the type of the argument doesn't match the metadata for the class.

The failing line of code is:
            LongLongStringFKRelationship b = em.find(LongLongStringFKRelationship.class, i);

The correct code is:
            LongLongStringFKRelationship b = em.find(LongLongStringFKRelationship.class, new LongLongStringOid(i));


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


[jira] Updated: (OPENJPA-1159) Bad error message for find of an Entity with compound primary key if parameter of wrong class

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

Donald Woods updated OPENJPA-1159:
----------------------------------

    Affects Version/s: 2.0.0-M2
        Fix Version/s:     (was: 2.0.0-M4)
                           (was: 2.0.0)

> Bad error message for find of an Entity with compound primary key if parameter of wrong class
> ---------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1159
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1159
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0-M2
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>            Priority: Minor
>             Fix For: 2.0.0-M3
>
>
> Test set: com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.234 sec <<< FAILURE!
> test(com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest)  Time elapsed: 4.168 sec  <<< ERROR!
> <openjpa-1.2.0-r422266:753657 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: 1
> 	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1154)
> 	at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
> 	at com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest.test(LongLongStringPKRelationshipTest.java:65)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
> 	at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve(ApplicationIds.java:602)
> 	at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.fetchLongField(ApplicationIds.java:578)
> 	at com.mysql.clusterj.jpatest.model.LongLongStringFKRelationship.pcCopyKeyFieldsToObjectId(LongLongStringFKRelationship.java)
> 	at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:172)
> 	at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:218)
> 	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1141)
> 	... 30 more
> The failure is clearly a user error but the message is bad. The message should say that the type of the argument doesn't match the metadata for the class.
> The failing line of code is:
>             LongLongStringFKRelationship b = em.find(LongLongStringFKRelationship.class, i);
> The correct code is:
>             LongLongStringFKRelationship b = em.find(LongLongStringFKRelationship.class, new LongLongStringOid(i));

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


[jira] Resolved: (OPENJPA-1159) Bad error message for find of an Entity with compound primary key if parameter of wrong class

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

Pinaki Poddar resolved OPENJPA-1159.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-M4
                   2.0.0-M3

This has been fixed in OPENJPA-365. 

Please reopen if the error message is still poor.

> Bad error message for find of an Entity with compound primary key if parameter of wrong class
> ---------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1159
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1159
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Craig Russell
>            Assignee: Craig Russell
>            Priority: Minor
>             Fix For: 2.0.0-M3, 2.0.0-M4, 2.0.0
>
>
> Test set: com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.234 sec <<< FAILURE!
> test(com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest)  Time elapsed: 4.168 sec  <<< ERROR!
> <openjpa-1.2.0-r422266:753657 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: 1
> 	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1154)
> 	at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
> 	at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
> 	at com.mysql.clusterj.openjpatest.LongLongStringPKRelationshipTest.test(LongLongStringPKRelationshipTest.java:65)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
> 	at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve(ApplicationIds.java:602)
> 	at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.fetchLongField(ApplicationIds.java:578)
> 	at com.mysql.clusterj.jpatest.model.LongLongStringFKRelationship.pcCopyKeyFieldsToObjectId(LongLongStringFKRelationship.java)
> 	at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:172)
> 	at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:218)
> 	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1141)
> 	... 30 more
> The failure is clearly a user error but the message is bad. The message should say that the type of the argument doesn't match the metadata for the class.
> The failing line of code is:
>             LongLongStringFKRelationship b = em.find(LongLongStringFKRelationship.class, i);
> The correct code is:
>             LongLongStringFKRelationship b = em.find(LongLongStringFKRelationship.class, new LongLongStringOid(i));

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