From dev-return-8739-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri Jul 25 20:47:54 2008 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 57243 invoked from network); 25 Jul 2008 20:47:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jul 2008 20:47:54 -0000 Received: (qmail 14379 invoked by uid 500); 25 Jul 2008 20:47:52 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 14323 invoked by uid 500); 25 Jul 2008 20:47:52 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 14286 invoked by uid 99); 25 Jul 2008 20:47:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jul 2008 13:47:52 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jul 2008 20:47:05 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id ACD8B234C186 for ; Fri, 25 Jul 2008 13:47:31 -0700 (PDT) Message-ID: <810123573.1217018851706.JavaMail.jira@brutus> Date: Fri, 25 Jul 2008 13:47:31 -0700 (PDT) From: "Pinaki Poddar (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Resolved: (OPENJPA-572) Merge operation fails with IdClass composite key In-Reply-To: <2092496927.1208377161696.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on 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" 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.