Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-365

Unexpected behavior on finding a Composite Key entity with a single value.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: kernel
    • Labels:
      None
    • Environment:
      Windows XP, JDK 1.5, OpenJPA 0.9.7

      Description

      Entity A has a composite key AId, thus User should look up A with an instance of AId.
      Example: em.find(A.class, new AId());

      In case of looking up A with a single value, for example: em.find(A.class, 12345). It will through an unexpected exception:
      >>>The id type "AId" specfied by persistent type "A" does not have a public string or class + string constructor.

      >>>>> org.apache.openjpa.kernel.BrokerImpl.newObjectId
      >>>>> (BrokerImpl.java:1120)
      >>>>> [WLServer TmsServer] at
      >>>>> org.apache.openjpa.kernel.DelegatingBroker.newObjectId
      >>>>> (DelegatingBroker.java:254)
      >>>>> [WLServer TmsServer] at
      >>>>> org.apache.openjpa.persistence.EntityManagerImpl.find
      >>>>> (EntityManagerImpl.java:345)

      I suppose to get an exception of error id type.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ppoddar@apache.org Pinaki Poddar
                Reporter:
                mikecool Gene Wu
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: