Dianne Richards created OPENJPA-2221:
----------------------------------------
Summary: Use of AbstractValueHandler map() causes exception on
find()
Key: OPENJPA-2221
URL: https://issues.apache.org/jira/browse/OPENJPA-2221
Project: OpenJPA
Issue Type: Bug
Affects Versions: 2.1.0
Reporter: Dianne Richards
Assignee: Dianne Richards
Fix For: 2.1.1
When a value strategy implemented by a subclass of AbstractValuehandler
overrides the map() method, an exception occurs on a find() if the strategy is
implemented on an id field. The method returns a Column[].
<openjpa-2.1.2-SNAPSHOT-r422266:1297100 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: The specified parameter of
type "class [Ljava.lang.Object;" is not a valid query parameter.
FailedObject: id1 [org.apache.openjpa.util.StringId] [java.lang.String]
at
org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(DBDictionary.java:1465)
at
org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(DBDictionary.java:1391)
at
org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:656)
at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:565)
at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:541)
at
org.apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java:479)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:420)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:382)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getInitializeStateResult(JDBCStoreManager.java:576)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:333)
at
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
at
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1027)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:985)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:902)
at
org.apache.openjpa.kernel.DelegatingBroker.find(DelegatingBroker.java:231)
at
org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:486)
at
org.apache.openjpa.persistence.strategy.value.TestValueStrategy.testIt(TestValueStrategy.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at junit.framework.TestCase.runTest(TestCase.java:154)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:579)
at junit.framework.TestCase.runBare(TestCase.java:127)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:566)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:542)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:206)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Presumably the exception would occur on other fields if they were part of the
query.
The DBDictionary setUnknown() method needs to handle input of an Object[].
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira