You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Chadwick M Baatz (JIRA)" <ji...@apache.org> on 2008/04/16 22:19:21 UTC
[jira] Created: (OPENJPA-572) Merge operation fails with IdClass
composite key
Merge operation fails with IdClass composite key
------------------------------------------------
Key: OPENJPA-572
URL: https://issues.apache.org/jira/browse/OPENJPA-572
Project: OpenJPA
Issue Type: Bug
Affects Versions: 1.0.2
Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
Libraries:
commons:
- Collections
- DBCP
- Lang
- Logging
- Pool
Geronimo
- jpa_ 3.0_spec-1.0
- jta_1.1_spec-1.1
OpenJpa 1.0.2
Serp
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(BrokerImpl.java:1094)
at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
at idclass.TestSave.main(TestSave.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick updated OPENJPA-572:
---------------------------------
Fix Version/s: (was: 1.0.3)
1.2.0
1.0.4
Defer to next release.
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Fix For: 1.0.4, 1.2.0
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592739#action_12592739 ]
Patrick Linskey commented on OPENJPA-572:
-----------------------------------------
Moving to 1.0.3
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Fix For: 1.0.3
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Chadwick M Baatz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chadwick M Baatz updated OPENJPA-572:
-------------------------------------
Attachment: test.zip
Contains example code that causes failure. TestSave under embedded package works, TestSave under idclass package fails.
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Fix For: 1.0.2
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605009#action_12605009 ]
Fay Wang commented on OPENJPA-572:
----------------------------------
Hi, This problem could be reproduced in openjpa 1.2 before Patrick checked in VersionAttachStrategy (r666896) for JIRA-245. As you said, the merge for IdClass failed, but works for embedded class. After Patrick's fix, the merge for IdClass works fine, but embedded id class now failed for merge. I did some investigation, and found that in your test case, you have both generatedValue annotation and EmbeddedId annotation, which makes openjpa think the detached object is a new entity. If I commented out the GeneratedValue annotation, your test case works fine when merging the entity with embedded id. .
@Entity
@Table(name = "cvss_vector")
public class CvssVector
implements Serializable
{
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cvss_vector_id", nullable = false, unique = true, updatable = false)
private Long id = null;
@EmbeddedId
private CvssVectorId emId = null;
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Fix For: 1.0.3
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Linskey updated OPENJPA-572:
------------------------------------
Fix Version/s: (was: 1.0.2)
1.0.3
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Fix For: 1.0.3
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pinaki Poddar resolved OPENJPA-572.
-----------------------------------
Resolution: Cannot Reproduce
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Assignee: Pinaki Poddar
> Fix For: 1.0.4, 1.2.0
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (OPENJPA-572) Merge operation fails with IdClass
composite key
Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pinaki Poddar reassigned OPENJPA-572:
-------------------------------------
Assignee: Pinaki Poddar
> Merge operation fails with IdClass composite key
> ------------------------------------------------
>
> Key: OPENJPA-572
> URL: https://issues.apache.org/jira/browse/OPENJPA-572
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.0.2
> Environment: Windows XP Pro, MySQL 5.1x, Java JDK 1.5
> Libraries:
> commons:
> - Collections
> - DBCP
> - Lang
> - Logging
> - Pool
> Geronimo
> - jpa_ 3.0_spec-1.0
> - jta_1.1_spec-1.1
> OpenJpa 1.0.2
> Serp
> MySQL Connector/J (latest)
> Reporter: Chadwick M Baatz
> Assignee: Pinaki Poddar
> Fix For: 1.0.4, 1.2.0
>
> Attachments: test.zip
>
>
> 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(BrokerImpl.java:1094)
> at org.apache.openjpa.kernel.VersionAttachStrategy.findFromDatabase(VersionAttachStrategy.java:372)
> at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:77)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
> at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
> at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3160)
> at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1142)
> at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:665)
> at idclass.TestSave.main(TestSave.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
> at idclass.CvssVector.pcCopyKeyFieldsToObjectId(CvssVector.java)
> at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
> at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:195)
> at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1087)
> ... 13 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.