Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 44741 invoked from network); 4 Apr 2006 16:23:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Apr 2006 16:23:40 -0000 Received: (qmail 20319 invoked by uid 500); 4 Apr 2006 16:23:35 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 20295 invoked by uid 500); 4 Apr 2006 16:23:35 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 20284 invoked by uid 99); 4 Apr 2006 16:23:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2006 09:23:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ammulder@gmail.com designates 64.233.166.182 as permitted sender) Received: from [64.233.166.182] (HELO pproxy.gmail.com) (64.233.166.182) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2006 09:23:34 -0700 Received: by pproxy.gmail.com with SMTP id e30so521727pya for ; Tue, 04 Apr 2006 09:23:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=AV+8nGUNp2P6ci2e15d3ocEP3ibtdhp5BlwnL8NGXKKWEyij25CH1E4xuTq16yBi9Go+eTc6PdxUlfRnfFqOC1coC0WwsEjF7N6thRW4TeUR4QENKq39TEZxb59QaR9V/yFLGvl2/x2sQzIbjMN5VUxs2JYdhFu5gED7cMWzyiU= Received: by 10.35.9.2 with SMTP id m2mr730828pyi; Tue, 04 Apr 2006 09:23:13 -0700 (PDT) Received: by 10.35.116.1 with HTTP; Tue, 4 Apr 2006 09:23:13 -0700 (PDT) Message-ID: <74e15baa0604040923re04e43ap71f568eb88a06d0c@mail.gmail.com> Date: Tue, 4 Apr 2006 12:23:13 -0400 From: "Aaron Mulder" Sender: ammulder@gmail.com To: user@geronimo.apache.org Subject: Re: FindByPrimaryKey In-Reply-To: <124d285e0604040900l619c7ce3vfe5af283ce5a6066@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <124d285e0604040900l619c7ce3vfe5af283ce5a6066@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N What's the actual problem? When you call findByPrimaryKey, is it returning nothing, or giving you a stack trace, or what? I think your primary key class is supposed to have getters and setters for all the properties, with names matching the primary key fields on the bean. So it may be that you need a getChassi and setChassi on the PK class to get it working. Thanks, Aaron P.S. Ever played Car Wars? :) On 4/4/06, Olivier Voutat wrote: > I'm in trouble (again lol) with the findByPrimaryKey method. > > CarLocalHome localHomeCar =3D Locator.getCarLocalHome(); > CarLocal tempcar =3D null; > try { > Iterator temp =3D > localHomeCar.findBySituation("Avaliable").iterator(); > CarPK pk =3D new CarPK(); > while (temp.hasNext()) { > tempcar =3D (CarLocal)temp.next(); > System.out.println("Primary Key " + > tempcar.getPrimaryKey().toString()); > pk =3D (CarroPK)tempcar.getPrimaryKey(); > } > System.out.println(pk.chassi); > System.out.println("Everything works fine until here."); > > CarLocal mycar =3D localHomeCar.findByPrimaryKey(new CarPK("CHASSSICODE"= ); > //HERE I don't get to pick my ejbLocalObjet by the primary key. > > CarLocal mycar =3D localHomeCar.findByPrimaryKey(pk); > //Tried this way too but no success > -------------------------------------------------------------------------= ------------------------------------------------------ > // This is my CarPK class > package br.cefetrn.olivier.entity; > > import java.io.Serializable; > > public class CarPK implements Serializable { > > private static final long serialVersionUID =3D 1L; > public String chassi; > > public CarroPK() {} > > public CarroPK(String chas) { > this.chassi =3D chas; > } > > public String toString() { > return chassi.toString(); > } > > public int hashCode() { > return chassi.hashCode(); > } > > public boolean equals(Object car) { > return ((CarroPK)car).chassi.equals(chassi); > } > } > -------------------------------------------------------------------------= ------------------------------------------------------ > // This is my ejb-jar.xml code > > Car > > br.cefetrn.olivier.entity.CarLocalHome > br.cefetrn.olivier.entity.CarLocal > > br.cefetrn.olivier.entity.CarBean > Container > br.cefetrn.olivier.entity.CarPK > /////////////My PK class > false > 2.x > CARS > > chassi > > manufacturer > > model > > plaque > km > > color > > situation > > type > > price > > Fire > javax.sql.DataSource > Container > > Shareable > > > > Does anyone knows what I'm doing wrong in this findByPrimaryKey ? > Best Regards, > -- > Olivier Voutat > Rua Praia de Muri=FA, 9188 > Cep 59092-390 / Natal - RN > Tel: (84) 3219-0427 Cel: (84) 9977-3917