From dev-return-6137-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Tue Sep 11 17:21:28 2007 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 26741 invoked from network); 11 Sep 2007 17:21:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2007 17:21:28 -0000 Received: (qmail 76116 invoked by uid 500); 11 Sep 2007 17:21:21 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 76094 invoked by uid 500); 11 Sep 2007 17:21:21 -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 76084 invoked by uid 99); 11 Sep 2007 17:21:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 10:21:21 -0700 X-ASF-Spam-Status: No, hits=-0.8 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.43.132] (HELO sca-es-mail-1.sun.com) (192.18.43.132) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 17:22:49 +0000 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id l8BHKqmc025861 for ; Tue, 11 Sep 2007 10:20:52 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JO700C01S47FO00@fe-sfbay-09.sun.com> (original mail from Craig.Russell@Sun.COM) for dev@openjpa.apache.org; Tue, 11 Sep 2007 10:20:52 -0700 (PDT) Received: from [129.145.133.227] by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JO700BJQS6Q1830@fe-sfbay-09.sun.com> for dev@openjpa.apache.org; Tue, 11 Sep 2007 10:20:50 -0700 (PDT) Date: Tue, 11 Sep 2007 10:20:45 -0700 From: Craig L Russell Subject: Re: ID class: no public string or class + string constructor? In-reply-to: Sender: Craig.Russell@Sun.COM To: dev@openjpa.apache.org Message-id: MIME-version: 1.0 X-Mailer: Apple Mail (2.752.3) Content-type: multipart/signed; protocol="application/pkcs7-signature"; boundary=Apple-Mail-241-770647791; micalg=sha1 References: <113467.5166.qm@web39513.mail.mud.yahoo.com> <35E3DA3B-6AC2-48C5-B4CA-46951F7ED454@SUN.com> <28789D56-0E02-42ED-9DC2-A6D41D9E0FBB@SUN.com> <12608201.post@talk.nabble.com> <46E63E37.2020308@Sun.COM> <46E649D7.1030705@Sun.COM> X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-241-770647791 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Hi Gene, On Sep 11, 2007, at 2:12 AM, Gene Wu wrote: > absolutely you are right. the error comes from my 2nd testing. =20 > Sorry for misleading. > > > Finally, I found the problem from my colleague's code. Maybe I can =20 > commit a defect to JIRA. > > The root cause of that issue is: > > PeoplesoftSegmentEntity entity =3D _em.find=20 > (PeoplesoftSegmentEntity.class, 12345); > > As you know PeoplesoftSegmentEntity has composite key defined in =20 > PeoplesoftSegmentEntityId class. So when user try to find the =20 > entity, he must use the instance of Id class. > But in this case, he use int value 12345. It will cause the =20 > problem. But I think OpenJPA didn't matched key type when the user =20 > passed in the value. Yes, please file a JIRA for this issue. The find method should throw =20 an exception with a detail message saying that the key value doesn't =20 match the id type. Thanks, Craig > > > Thanks, > > Gene. >> Date: Tue, 11 Sep 2007 13:25:03 +0530 >> From: Sahoo@Sun.COM >> Subject: Re: ID class: no public string or class + string =20 >> constructor? >> To: dev@openjpa.apache.org >> >> Then you probably have a classpath/packaging issue. The OpenJPA error >> contains a nested class name (see $ in the name): >> com.werner.accounting.model.PeoplesoftSegmentEntity=20 >> $PeoplesoftSegmentId. >> >> Thanks, >> Sahoo >> >> Gene Wu wrote: >>> no, it's a top level class. >>> >>> I also tried static nested class. Still the same issue I met. >>> >>> Thanks, >>> Gene >>> >>> >>> >>>> Date: Tue, 11 Sep 2007 12:35:27 +0530 >>>> From: Sahoo@Sun.COM >>>> Subject: Re: ID class: no public string or class + string =20 >>>> constructor? >>>> To: dev@openjpa.apache.org >>>> >>>> Is PeoplesoftSegmentId an *inner* (i.e. non-static nested) =20 >>>> class? Make >>>> it a static nested class or a top level class and try. >>>> >>>> Thanks, >>>> Sahoo >>>> >>>> Gene Wu wrote: >>>> >>>>> Here is the error stack: >>>>> >>>>> [WLServer TmsServer] javax.ejb.EJBException: nested exception =20 >>>>> is: <0|false|0.9.7> =20 >>>>> org.apache.openjpa.persistence.PersistenceException: >>>>> The id type "class =20 >>>>> com.werner.accounting.model.PeoplesoftSegmentEntity=20 >>>>> $PeoplesoftSegmentId" specfied by persistent type "class com.wer >>>>> er.accounting.model.PeoplesoftSegmentEntity" does not have a =20 >>>>> public string or class + string constructor. >>>>> [WLServer TmsServer] <0|false|0.9.7> =20 >>>>> org.apache.openjpa.persistence.PersistenceException: The id =20 >>>>> type "class com.werner.accounting.mod >>>>> l.PeoplesoftSegmentEntity$PeoplesoftSegmentId" specfied by =20 >>>>> persistent type "class =20 >>>>> com.werner.accounting.model.PeoplesoftSegmentEntity" >>>>> does not have a public string or class + string constructor. >>>>> [WLServer TmsServer] at =20 >>>>> org.apache.openjpa.kernel.BrokerImpl.newObjectId=20 >>>>> (BrokerImpl.java:1120) >>>>> [WLServer TmsServer] at =20 >>>>> org.apache.openjpa.kernel.DelegatingBroker.newObjectId=20 >>>>> (DelegatingBroker.java:254) >>>>> [WLServer TmsServer] at =20 >>>>> org.apache.openjpa.persistence.EntityManagerImpl.find=20 >>>>> (EntityManagerImpl.java:345) >>>>> [WLServer TmsServer] at =20 >>>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> >>>>> >>>>> BTW, I didn't find any IdClass test cases in OpenJPA test suit. >>>>> >>>>> Thanks >>>>> >>>>> Gene. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Date: Mon, 10 Sep 2007 22:15:36 -0700 >>>>>> From: gene_wu@hotmail.com >>>>>> To: dev@openjpa.apache.org >>>>>> Subject: Re: ID class: no public string or class + string =20 >>>>>> constructor? >>>>>> >>>>>> >>>>>> I got the same exception. >>>>>> >>>>>> nested exception is: <0|false|0.9.7> >>>>>> org.apache.openjpa.persistence.PersistenceException: The id =20 >>>>>> type "class >>>>>> com.werner.accounting.model.PeoplesoftSegmentId" specfied by =20 >>>>>> persistent type >>>>>> "class com.werner.accounting.model.PeoplesoftSegmentEntity" =20 >>>>>> does not have a >>>>>> public string or class + string constructor >>>>>> >>>>>> ID Class is: >>>>>> >>>>>> public class PeoplesoftSegmentId implements Serializable { >>>>>> >>>>>> public String _businessUnit; >>>>>> >>>>>> public String _vasTourId; >>>>>> >>>>>> /** Creates a new instance of PeoplesoftSegmentId */ >>>>>> public PeoplesoftSegmentId() { >>>>>> >>>>>> } >>>>>> >>>>>> >>>>>> @Override >>>>>> public int hashCode() { >>>>>> >>>>>> int hash =3D 0; >>>>>> hash +=3D (this._businessUnit !=3D null ? =20 >>>>>> this._businessUnit.hashCode() : 0); >>>>>> hash +=3D (this._vasTourId !=3D null ? = this._vasTourId.hashCode=20 >>>>>> () : 0); >>>>>> return hash; >>>>>> } >>>>>> >>>>>> @Override >>>>>> public boolean equals(Object object) { >>>>>> >>>>>> if(!(object instanceof PeoplesoftSegmentId)) { >>>>>> return false; >>>>>> } >>>>>> PeoplesoftSegmentId other =3D = (PeoplesoftSegmentId)object; >>>>>> if(this._businessUnit !=3D other._businessUnit >>>>>> && (this._businessUnit =3D=3D null || >>>>>> !this._businessUnit.equals(other._businessUnit))) >>>>>> return false; >>>>>> if(this._vasTourId !=3D other._vasTourId >>>>>> && (this._vasTourId =3D=3D null || >>>>>> !this._vasTourId.equals(other._vasTourId))) >>>>>> return false; >>>>>> return true; >>>>>> } >>>>>> >>>>>> public String toString() { >>>>>> return _businessUnit + ":" + _vasTourId; >>>>>> } >>>>>> } >>>>>> >>>>>> Entity Class is: >>>>>> @Entity >>>>>> @IdClass(PeoplesoftSegmentId.class) >>>>>> public class PeoplesoftSegmentEntity implements Serializable { >>>>>> >>>>>> @Id >>>>>> private String _businessUnit; >>>>>> >>>>>> @Id >>>>>> private String _vasTourId; >>>>>> >>>>>> ... >>>>>> >>>>>> Thanks >>>>>> >>>>>> Gene. >>>>>> >>>>>> >>>>>> Craig L Russell wrote: >>>>>> >>>>>> >>>>>>> Are you using @Id or @IdClass or @EmbeddedId annotations? >>>>>>> >>>>>>> I'm looking at 2.1.4, 9.1.14, and 9.1.15 and trying to figure =20= >>>>>>> out >>>>>>> which case you're having trouble with. >>>>>>> >>>>>>> Craig >>>>>>> >>>>>>> On Mar 26, 2007, at 5:37 PM, Craig L Russell wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Hi Jeff, >>>>>>>> >>>>>>>> It would be useful if you could include a code fragment and =20 >>>>>>>> the @Id >>>>>>>> annotation for your class to diagnose this. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> >>>>>>>> Craig >>>>>>>> >>>>>>>> On Mar 26, 2007, at 4:35 PM, jeff wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> getting this error: >>>>>>>>> >>>>>>>>> The id type "class com.sun.portal.pom.FooId" specfied by >>>>>>>>> persistent type "class com.sun.portal.pom.Foo" does not have a >>>>>>>>> public string or class + string constructor. >>>>>>>>> >>>>>>>>> this error doesn't seem to correspond to any of the =20 >>>>>>>>> requirements >>>>>>>>> of an ID class as defined in the spec. >>>>>>>>> >>>>>>>>> my first guess is that it wants me to add an constructor that >>>>>>>>> takes the result of toString() and constructs the ID class =20 >>>>>>>>> based >>>>>>>>> on that, but adding a constructor that takes a string arg =20 >>>>>>>>> didn't >>>>>>>>> change the error. i don't understand what it would want for =20= >>>>>>>>> the >>>>>>>>> "class + string" constructor, so i was not sure what to try =20= >>>>>>>>> there. >>>>>>>>> >>>>>>>>> can someone help interpret this error? >>>>>>>>> thanks! >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> --------------------------------- >>>>>>>>> Never miss an email again! >>>>>>>>> Yahoo! Toolbar alerts you the instant new Mail arrives. =20 >>>>>>>>> Check it out. >>>>>>>>> >>>>>>>>> >>>>>>>> Craig Russell >>>>>>>> DB PMC, OpenJPA PPMC >>>>>>>> clr@apache.org http://db.apache.org/jdo >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> Craig Russell >>>>>>> Architect, Sun Java Enterprise System http://java.sun.com/=20 >>>>>>> products/jdo >>>>>>> 408 276-5638 mailto:Craig.Russell@sun.com >>>>>>> P.S. A good JDO? O, Gasp! >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> --=20 >>>>>> View this message in context: http://www.nabble.com/ID-class%=20 >>>>>> 3A-no-public-string-or-class-%2B-string-constructor--=20 >>>>>> tf3470194.html#a12608201 >>>>>> Sent from the OpenJPA Developers mailing list archive at =20 >>>>>> Nabble.com. >>>>>> >>>>>> >>>>>> >>>>> _________________________________________________________________ >>>>> Capture your memories in an online journal! >>>>> http://www.reallivemoms.com?ocid=3DTXT_TAGHM&loc=3Dus >>>>> >>>>> >>>>> >>> >>> _________________________________________________________________ >>> Capture your memories in an online journal! >>> http://www.reallivemoms.com?ocid=3DTXT_TAGHM&loc=3Dus >>> >>> > > _________________________________________________________________ > More photos; more messages; more whatever =96 Get MORE with Windows =20= > Live=99 Hotmail=AE. NOW with 5GB storage. > http://imagine-windowslive.com/hotmail/?locale=3Den-=20 > us&ocid=3DTXT_TAGHM_migration_HM_mini_5G_0907 Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:Craig.Russell@sun.com P.S. A good JDO? O, Gasp! --Apple-Mail-241-770647791 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUDCCAwkw ggJyoAMCAQICECpJVMO68ii+Xfsc1O1YYFIwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MTIwOTE5NTEwNVoXDTA3MTIwOTE5NTEw NVowbDEQMA4GA1UEBBMHUnVzc2VsbDEUMBIGA1UEKhMLQ3JhaWcgTGFpcmQxHDAaBgNVBAMTE0Ny YWlnIExhaXJkIFJ1c3NlbGwxJDAiBgkqhkiG9w0BCQEWFUNyYWlnLlJ1c3NlbGxAU3VuLkNPTTCC ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMNAB4Ih+ShsCt89HzqIdwEx8L4o1UHiY6V7 16mrCedfd4Y0/uI7z9Zam8ysgEh+F7aDnQEKmEsVFN35G4nPMfLU6dZYkvADwUjbq82t/dJ3FDDg Q945nHHpqECZff/S/UMho9AFfj6PZvZBAlDCJAayb4RdKIlfuvPW9YcQStQ1IfVJcVuKnC0Q+tdc a4A7zn7IzLOQohO1lTc3hXSBigEIGiGYn6Ny0wmexfA3X1WsXekFx5czd+M4GjDjswn8CNoBmnBr jOTGK1mOsXR6GSRHnly2s9xTdE4qv9qimM+7C2yzMHbKcszV7OQoLsRsZKDh+6u9wYU+TrjcY4ym bA8CAwEAAaMyMDAwIAYDVR0RBBkwF4EVQ3JhaWcuUnVzc2VsbEBTdW4uQ09NMAwG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