Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 89854 invoked from network); 11 Sep 2007 09:12:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2007 09:12:57 -0000 Received: (qmail 23524 invoked by uid 500); 11 Sep 2007 09:12:51 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 23375 invoked by uid 500); 11 Sep 2007 09:12:50 -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 23366 invoked by uid 99); 11 Sep 2007 09:12:50 -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 02:12:50 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gene_wu@hotmail.com designates 65.54.246.112 as permitted sender) Received: from [65.54.246.112] (HELO bay0-omc1-s40.bay0.hotmail.com) (65.54.246.112) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 09:14:17 +0000 Received: from BAY126-W2 ([65.55.131.37]) by bay0-omc1-s40.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 11 Sep 2007 02:12:22 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_6f956ab2-f2a2-442d-bee8-9af3ce00d3c5_" X-Originating-IP: [65.247.121.235] From: Gene Wu To: Subject: RE: ID class: no public string or class + string constructor? Date: Tue, 11 Sep 2007 09:12:22 +0000 Importance: Normal In-Reply-To: <46E649D7.1030705@Sun.COM> 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> MIME-Version: 1.0 X-OriginalArrivalTime: 11 Sep 2007 09:12:22.0213 (UTC) FILETIME=[DC7F1F50:01C7F453] X-Virus-Checked: Checked by ClamAV on apache.org --_6f956ab2-f2a2-442d-bee8-9af3ce00d3c5_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable absolutely you are right. the error comes from my 2nd testing. Sorry for mi= sleading. Finally, I found the problem from my colleague's code. Maybe I can commit a= defect to JIRA. The root cause of that issue is: PeoplesoftSegmentEntity entity =3D _em.find(PeoplesoftSegmentEntity.class, = 12345); As you know PeoplesoftSegmentEntity has composite key defined in Peoplesoft= SegmentEntityId class. So when user try to find the entity, he must use the= instance of Id class. But in this case, he use int value 12345. It will cause the problem. But I = think OpenJPA didn't matched key type when the user passed in the value. 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 constructor? > To: dev@openjpa.apache.org >=20 > Then you probably have a classpath/packaging issue. The OpenJPA error =20 > contains a nested class name (see $ in the name):=20 > com.werner.accounting.model.PeoplesoftSegmentEntity$PeoplesoftSegmentId. >=20 > Thanks, > Sahoo >=20 > Gene Wu wrote: > > no, it's a top level class. > > > > I also tried static nested class. Still the same issue I met. > > > > Thanks, > > Gene > > > > > > =20 > >> Date: Tue, 11 Sep 2007 12:35:27 +0530 > >> From: Sahoo@Sun.COM > >> Subject: Re: ID class: no public string or class + string constructor? > >> To: dev@openjpa.apache.org > >> > >> Is PeoplesoftSegmentId an *inner* (i.e. non-static nested) class? Make= =20 > >> it a static nested class or a top level class and try. > >> > >> Thanks, > >> Sahoo > >> > >> Gene Wu wrote: > >> =20 > >>> Here is the error stack: > >>> > >>> [WLServer TmsServer] javax.ejb.EJBException: nested exception is: <0|= false|0.9.7> org.apache.openjpa.persistence.PersistenceException: > >>> The id type "class com.werner.accounting.model.PeoplesoftSegmentEntit= y$PeoplesoftSegmentId" specfied by persistent type "class com.wer > >>> er.accounting.model.PeoplesoftSegmentEntity" does not have a public s= tring or class + string constructor. > >>> [WLServer TmsServer] <0|false|0.9.7> org.apache.openjpa.persistence.P= ersistenceException: The id type "class com.werner.accounting.mod > >>> l.PeoplesoftSegmentEntity$PeoplesoftSegmentId" specfied by persistent= type "class com.werner.accounting.model.PeoplesoftSegmentEntity" > >>> does not have a public string or class + string constructor. > >>> [WLServer TmsServer] at org.apache.openjpa.kernel.BrokerImpl.newOb= jectId(BrokerImpl.java:1120) > >>> [WLServer TmsServer] at org.apache.openjpa.kernel.DelegatingBroker= .newObjectId(DelegatingBroker.java:254) > >>> [WLServer TmsServer] at org.apache.openjpa.persistence.EntityManag= erImpl.find(EntityManagerImpl.java:345) > >>> [WLServer TmsServer] at sun.reflect.NativeMethodAccessorImpl.invok= e0(Native Method) > >>> > >>> > >>> BTW, I didn't find any IdClass test cases in OpenJPA test suit. > >>> > >>> Thanks > >>> > >>> Gene. > >>> > >>> > >>> > >>> =20 > >>> =20 > >>>> 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 constructo= r? > >>>> > >>>> > >>>> I got the same exception.=20 > >>>> > >>>> nested exception is: <0|false|0.9.7> > >>>> org.apache.openjpa.persistence.PersistenceException: The id type "cl= ass > >>>> com.werner.accounting.model.PeoplesoftSegmentId" specfied by persist= ent type > >>>> "class com.werner.accounting.model.PeoplesoftSegmentEntity" 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 ? this._businessUnit.hashC= ode() : 0); > >>>> hash +=3D (this._vasTourId !=3D null ? this._vasTourId.hashCode() = : 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: > >>>> =20 > >>>> =20 > >>>>> 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 out = =20 > >>>>> which case you're having trouble with. > >>>>> > >>>>> Craig > >>>>> > >>>>> On Mar 26, 2007, at 5:37 PM, Craig L Russell wrote: > >>>>> > >>>>> =20 > >>>>> =20 > >>>>>> Hi Jeff, > >>>>>> > >>>>>> It would be useful if you could include a code fragment and the @I= d =20 > >>>>>> annotation for your class to diagnose this. > >>>>>> > >>>>>> Thanks, > >>>>>> > >>>>>> Craig > >>>>>> > >>>>>> On Mar 26, 2007, at 4:35 PM, jeff wrote: > >>>>>> > >>>>>> =20 > >>>>>> =20 > >>>>>>> getting this error: > >>>>>>> > >>>>>>> The id type "class com.sun.portal.pom.FooId" specfied by =20 > >>>>>>> persistent type "class com.sun.portal.pom.Foo" does not have a =20 > >>>>>>> public string or class + string constructor. > >>>>>>> > >>>>>>> this error doesn't seem to correspond to any of the requirements = =20 > >>>>>>> of an ID class as defined in the spec. > >>>>>>> > >>>>>>> my first guess is that it wants me to add an constructor that =20 > >>>>>>> takes the result of toString() and constructs the ID class based = =20 > >>>>>>> on that, but adding a constructor that takes a string arg didn't = =20 > >>>>>>> change the error. i don't understand what it would want for the = =20 > >>>>>>> "class + string" constructor, so i was not sure what to try there= . > >>>>>>> > >>>>>>> can someone help interpret this error? > >>>>>>> thanks! > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> --------------------------------- > >>>>>>> Never miss an email again! > >>>>>>> Yahoo! Toolbar alerts you the instant new Mail arrives. Check it = out. > >>>>>>> =20 > >>>>>>> =20 > >>>>>> Craig Russell > >>>>>> DB PMC, OpenJPA PPMC > >>>>>> clr@apache.org http://db.apache.org/jdo > >>>>>> > >>>>>> > >>>>>> =20 > >>>>>> =20 > >>>>> 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! > >>>>> > >>>>> > >>>>> =20 > >>>>> > >>>>> =20 > >>>>> =20 > >>>> --=20 > >>>> View this message in context: http://www.nabble.com/ID-class%3A-no-p= ublic-string-or-class-%2B-string-constructor--tf3470194.html#a12608201 > >>>> Sent from the OpenJPA Developers mailing list archive at Nabble.com. > >>>> > >>>> =20 > >>>> =20 > >>> _________________________________________________________________ > >>> Capture your memories in an online journal! > >>> http://www.reallivemoms.com?ocid=3DTXT_TAGHM&loc=3Dus > >>> > >>> =20 > >>> =20 > > > > _________________________________________________________________ > > Capture your memories in an online journal! > > http://www.reallivemoms.com?ocid=3DTXT_TAGHM&loc=3Dus > > > > =20 _________________________________________________________________ More photos; more messages; more whatever =96 Get MORE with Windows Live=99= Hotmail=AE. NOW with 5GB storage. http://imagine-windowslive.com/hotmail/?locale=3Den-us&ocid=3DTXT_TAGHM_mig= ration_HM_mini_5G_0907= --_6f956ab2-f2a2-442d-bee8-9af3ce00d3c5_--