openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chadwick M Baatz (JIRA)" <>
Subject [jira] Created: (OPENJPA-572) Merge operation fails with IdClass composite key
Date Wed, 16 Apr 2008 20:19:21 GMT
Merge operation fails with IdClass composite key

                 Key: OPENJPA-572
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.0.2
         Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
     - Collections
     - DBCP
     - Lang
     - Logging
     - Pool
     - jpa_ 3.0_spec-1.0
     - jta_1.1_spec-1.1
   OpenJpa 1.0.2
   MySQL Connector/J (latest)
            Reporter: Chadwick M Baatz
             Fix For: 1.0.2

I've tried to use composite keys through the IdClass annotation, but the merge operation fails
with the following error.  I used the ApplicationIdTool to generate the IdClass object.  What's
odd is that I can take that exact same code and just switch the logic to use the Embeddable/EmbeddedId
annotations and the merge command works.

Exception in thread "main" <openjpa-1.0.2-r420667:627158 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
The given value "idclass.CvssVector-1.0::Base" cannot be converted into an identity for "class
idclass.CvssVector".  The value is the wrong type (org.apache.openjpa.util.ObjectId).
	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(
	at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(
	at org.apache.openjpa.kernel.VersionAttachStrategy.attach(
	at org.apache.openjpa.kernel.AttachManager.attach(
	at org.apache.openjpa.kernel.AttachManager.attach(
	at org.apache.openjpa.kernel.BrokerImpl.attach(
	at org.apache.openjpa.kernel.DelegatingBroker.attach(
	at org.apache.openjpa.persistence.EntityManagerImpl.merge(
	at idclass.TestSave.main(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at com.intellij.rt.execution.application.AppMain.main(
Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
	at idclass.CvssVector.pcCopyKeyFieldsToObjectId(
	at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(
	at org.apache.openjpa.util.ApplicationIds.fromPKValues(
	at org.apache.openjpa.kernel.BrokerImpl.newObjectId(
	... 13 more

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message