Description
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);
Attachments
Issue Links
- duplicates
-
OPENJPA-365 Unexpected behavior on finding a Composite Key entity with a single value.
- Closed