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:
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.