OpenJPA
  1. OpenJPA
  2. OPENJPA-1976

EntityManager.find method cause errors

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: jpa
    • Labels:
    • Environment:
      Glassfish 3.1, JSF 2.1.0, Apache OpenJPA 2.1.0, MySQL 5.5.10, Eclipse Helios IDE, Windows XP Service Pack 3

      Description

      Scenario 1: The EntityManager.find method is unable to pass a String value as its second parameter and caused the following error:

      <openjpa-2.1.0-r422266:1071316 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: The given value "214736890D96ED598E1D3050F1F025A7" cannot be converted into an identity for "com.ckd.model.BookModel". The value is the wrong type (java.lang.String).

      java.lang.NumberFormatException: For input string: "214736890D96ED598E1D3050F1F025A7"

      It seems from the errors above that the EntityManager.find method will only accept a numeric value as its second parameter.

      Scenario 2: The EntityManager.find method is unable to pass a Long value and caused the following error:

      <openjpa-2.1.0-r422266:1071316 fatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while processing registered class "class com.ckd.model.BookModel".

      java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped

      The columns used for testing are from a MySQL 5.x table and have the following definitions:

      ID SMALLINT(5)
      HASHID VARCHAR(32)

      The value of HASHID is used to test Scenario 1; while the value of ID is used to test Scenario 2.

      Conclusion: The above scenarios show that the EntityManager.find method is currently unusable/buggy and needs to be investigated for the next release.

      1. ENTITY.txt
        2 kB
        Chuong Pham
      2. SCENARIO 1 STACKTRACE.txt
        36 kB
        Chuong Pham
      3. SCENARIO 2 STACKTRACE.txt
        39 kB
        Chuong Pham

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Rick Curtis
              Reporter:
              Chuong Pham
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development