OpenJPA
  1. OpenJPA
  2. OPENJPA-2221

Use of AbstractValueHandler map() causes exception on find()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.1, 2.3.0
    • Component/s: None
    • Labels:
      None

      Description

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

        Activity

        Dianne Richards created issue -
        Dianne Richards made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Jody Grassel made changes -
        Assignee Dianne Richards [ dianner ] Jody Grassel [ fyrewyld ]
        Mark Struberg made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.3.0 [ 12319463 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Jody Grassel
            Reporter:
            Dianne Richards
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development