Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 49987 invoked from network); 11 Sep 2007 07:02:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2007 07:02:36 -0000 Received: (qmail 71013 invoked by uid 500); 11 Sep 2007 07:02:29 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 70977 invoked by uid 500); 11 Sep 2007 07:02:29 -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 70968 invoked by uid 99); 11 Sep 2007 07:02:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 00:02:29 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.19.7] (HELO sineb-mail-2.sun.com) (192.18.19.7) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 07:02:24 +0000 Received: from fe-apac-05.sun.com (fe-apac-05.sun.com [192.18.19.176] (may be forged)) by sineb-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l8B71tnP004926 for ; Tue, 11 Sep 2007 07:02:02 GMT Received: from conversion-daemon.mail-apac.sun.com by mail-apac.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JO600601ZEGLJ00@mail-apac.sun.com> (original mail from Sahoo@Sun.COM) for dev@openjpa.apache.org; Tue, 11 Sep 2007 15:01:55 +0800 (SGT) Received: from [192.168.1.10] ([59.96.46.43]) by mail-apac.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0JO600F0QZJ5TPB0@mail-apac.sun.com> for dev@openjpa.apache.org; Tue, 11 Sep 2007 15:01:55 +0800 (SGT) Date: Tue, 11 Sep 2007 12:35:27 +0530 From: Sahoo Subject: Re: ID class: no public string or class + string constructor? In-reply-to: Sender: Sanjeeb.Sahoo@Sun.COM To: dev@openjpa.apache.org Message-id: <46E63E37.2020308@Sun.COM> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT 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> User-Agent: Thunderbird 2.0.0.0 (X11/20070419) X-Virus-Checked: Checked by ClamAV on apache.org Is PeoplesoftSegmentId an *inner* (i.e. non-static nested) 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 is: <0|false|0.9.7> org.apache.openjpa.persistence.PersistenceException: > The id type "class com.werner.accounting.model.PeoplesoftSegmentEntity$PeoplesoftSegmentId" 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.PersistenceException: 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.newObjectId(DelegatingBroker.java:254) > [WLServer TmsServer] at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:345) > [WLServer TmsServer] at 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 constructor? >> >> >> I got the same exception. >> >> 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 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 = 0; >> hash += (this._businessUnit != null ? this._businessUnit.hashCode() : 0); >> hash += (this._vasTourId != null ? this._vasTourId.hashCode() : 0); >> return hash; >> } >> >> @Override >> public boolean equals(Object object) { >> >> if(!(object instanceof PeoplesoftSegmentId)) { >> return false; >> } >> PeoplesoftSegmentId other = (PeoplesoftSegmentId)object; >> if(this._businessUnit != other._businessUnit >> && (this._businessUnit == null || >> !this._businessUnit.equals(other._businessUnit))) >> return false; >> if(this._vasTourId != other._vasTourId >> && (this._vasTourId == 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 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 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 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 based >>>>> on that, but adding a constructor that takes a string arg didn't >>>>> change the error. i don't understand what it would want for the >>>>> "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 >>>> >>>> >>>> >>> 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! >>> >>> >>> >>> >>> >> -- >> 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. >> >> > > _________________________________________________________________ > Capture your memories in an online journal! > http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us > >