openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donald Woods (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-1159) Bad error message for find of an Entity with compound primary key if parameter of wrong class
Date Tue, 22 Sep 2009 19:20:16 GMT

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


Mime
View raw message