Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 38504 invoked from network); 11 Sep 2007 06:30:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2007 06:30:43 -0000 Received: (qmail 37269 invoked by uid 500); 11 Sep 2007 06:30:37 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 37236 invoked by uid 500); 11 Sep 2007 06:30:36 -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 37227 invoked by uid 99); 11 Sep 2007 06:30:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Sep 2007 23:30:36 -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 (athena.apache.org: domain of gene_wu@hotmail.com designates 65.54.246.74 as permitted sender) Received: from [65.54.246.74] (HELO bay0-omc1-s2.bay0.hotmail.com) (65.54.246.74) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 06:30:31 +0000 Received: from BAY126-W22 ([65.55.131.57]) by bay0-omc1-s2.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 10 Sep 2007 23:30:11 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_3227eb58-4b3e-4201-a7f3-383af2191e50_" 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 06:30:11 +0000 Importance: Normal In-Reply-To: <12608201.post@talk.nabble.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> MIME-Version: 1.0 X-OriginalArrivalTime: 11 Sep 2007 06:30:11.0217 (UTC) FILETIME=[345EF810:01C7F43D] X-Virus-Checked: Checked by ClamAV on apache.org --_3227eb58-4b3e-4201-a7f3-383af2191e50_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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.PeoplesoftSegmentEntity$Peop= lesoftSegmentId" specfied by persistent type "class com.wer er.accounting.model.PeoplesoftSegmentEntity" does not have a public string = or class + string constructor. [WLServer TmsServer] <0|false|0.9.7> org.apache.openjpa.persistence.Persist= enceException: 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.newObjectId= (BrokerImpl.java:1120) [WLServer TmsServer] at org.apache.openjpa.kernel.DelegatingBroker.newOb= jectId(DelegatingBroker.java:254) [WLServer TmsServer] at org.apache.openjpa.persistence.EntityManagerImpl= .find(EntityManagerImpl.java:345) [WLServer TmsServer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Nat= ive 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 constructor? >=20 >=20 > I got the same exception.=20 >=20 > nested exception is: <0|false|0.9.7> > org.apache.openjpa.persistence.PersistenceException: The id type "class > com.werner.accounting.model.PeoplesoftSegmentId" specfied by persistent t= ype > "class com.werner.accounting.model.PeoplesoftSegmentEntity" does not have= a > public string or class + string constructor >=20 > ID Class is: >=20 > public class PeoplesoftSegmentId implements Serializable { >=20 > public String _businessUnit; >=20 > public String _vasTourId; >=20 > /** Creates a new instance of PeoplesoftSegmentId */ > public PeoplesoftSegmentId() { >=20 > } >=20 >=20 > @Override > public int hashCode() { >=20 > int hash =3D 0; > hash +=3D (this._businessUnit !=3D null ? this._businessUnit.hashCode()= : 0); > hash +=3D (this._vasTourId !=3D null ? this._vasTourId.hashCode() : 0); > return hash; > } >=20 > @Override > public boolean equals(Object object) { >=20 > 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; > } >=20 > public String toString() { > return _businessUnit + ":" + _vasTourId; > } > } >=20 > Entity Class is: > @Entity > @IdClass(PeoplesoftSegmentId.class) > public class PeoplesoftSegmentEntity implements Serializable { >=20 > @Id > private String _businessUnit; >=20 > @Id > private String _vasTourId; >=20 > ... >=20 > Thanks >=20 > Gene. >=20 >=20 > Craig L Russell wrote: > >=20 > > Are you using @Id or @IdClass or @EmbeddedId annotations? > >=20 > > 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. > >=20 > > Craig > >=20 > > On Mar 26, 2007, at 5:37 PM, Craig L Russell wrote: > >=20 > >> Hi Jeff, > >> > >> It would be useful if you could include a code fragment and the @Id =20 > >> 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 =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. > >> > >> Craig Russell > >> DB PMC, OpenJPA PPMC > >> clr@apache.org http://db.apache.org/jdo > >> > >> > >=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 >=20 > --=20 > View this message in context: http://www.nabble.com/ID-class%3A-no-public= -string-or-class-%2B-string-constructor--tf3470194.html#a12608201 > Sent from the OpenJPA Developers mailing list archive at Nabble.com. >=20 _________________________________________________________________ Capture your memories in an online journal! http://www.reallivemoms.com?ocid=3DTXT_TAGHM&loc=3Dus= --_3227eb58-4b3e-4201-a7f3-383af2191e50_--