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

Reply via email to