EntityManager.find method cause errors
--------------------------------------
Key: OPENJPA-1976
URL: https://issues.apache.org/jira/browse/OPENJPA-1976
Project: OpenJPA
Issue Type: Bug
Components: jpa
Affects Versions: 2.1.0
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
Reporter: Chuong Pham
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.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira