geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Voutat" <olivier.vou...@gmail.com>
Subject Re: FindByPrimaryKey
Date Wed, 05 Apr 2006 23:52:27 GMT
Thanks Dale for the tip, really the findByPrimaryKey is working but
unfortunately I'm still having trouble cause of the syntax for Firebird. I
thought about doing the findByPrimaryKey this way, but in the end I forgot
to try it.

Think will have to use JBoss for this. I have to present this work Friday
morning. They already have Firebird support. Don't know if there is a way to
take a look at it.

My stack trace caused at the update moment returned me this line.

Caused by: org.tranql.ql.QueryException: Error executing statement: UPDATE
CARRO
S SET MARCA = CASE WHEN ? THEN ? ELSE MARCA END, MODELO = CASE WHEN ? THEN ?
ELSE MODELO END, PLACA = CASE WHEN ? THEN ? ELSE PLACA END, QUILOMETRAGEM =
CASE WHEN ? THEN ? ELSE QUILOMETRAGEM END, COR = CASE WHEN ? THEN ? ELSE COR
END, SITUACAO = CASE WHEN ? THEN ? ELSE SITUACAO END, TIPO = CASE WHEN ?
THEN ? ELSE TIPO END, DIARIA = CASE WHEN ? THEN ? ELSE DIARIA END WHERE
CHASSI = ?

Best Regards,
Olivier Voutat


On 4/5/06, Dale de los Reyes <dreyes4@hotmail.com> wrote:
>
> Hi Olivier,
>
> In your original post, you mentioned CarPK as your primary key object. I
> noticed this class has only a single primary key of type String (chassis,
> I
> think it was called). Anyway, for the entity bean that uses CarPK as the
> primary key. If possible, you can try converting it to use type String as
> the primary key. So now your findByPrimaryKey method will be using type
> String instead of CarPK.
>
> I've gotten CMP to work in Geronimo using a simple primary key of type
> Integer, so I'm almost certain it should work for String. On the other
> hand,
> if your architecture requires the use of compound keys (ie. multiple
> columns
> needed to make a unique ID like firstname+lastname) in your other entity
> beans. You might need to use BMP, unless one of the developers give the
> official word on the correct solution. Granted, this may not answer your
> original question, but hopefully it will get you moving forward.
>
> Personally, I had a similar situation with CMP using findByPrimaryKey with
> a
> primary key class. However, I was using Derby, and I was getting an
> ObjectNotFoundException.
>
> Hopefully, others know how to get compound keys working with CMP. I still
> would like to know.
>
> Later,
> Dale
>
> Finally, here's some code to help illustrate. Just in case...
>
> In the home interface...
> public <some object> create(CarPK carPK)....
> public <some object> findByPrimaryKey(String key)....
>
> In the implementation...
> public String ejbCreate(CarPK carPK)
> {
>    //set stuff from carPK here...
>    return null;
> }
>
> In the ejb-jar.xml...
> <ejb-jar>
>    <enterprise-beans>
>    <entity>
>    <!-- your original stuff here...->
>
>    <prim-key-class>java.lang.String</prim-key-class>
>
>    <!-- more of your original stuff -->
>    <!-- multiple declarations of cmp-field here -->
>
>    <primkey-field>chassis</primkey-field>
>    </entity>
>    </enterprise-beans>
> </ejb-jar>
>
> Your openejb-jar.xml should not have to change.
>
>
> >From: "Olivier Voutat" <olivier.voutat@gmail.com>
> >Reply-To: user@geronimo.apache.org
> >To: user@geronimo.apache.org
> >Subject: Re: FindByPrimaryKey
> >Date: Wed, 5 Apr 2006 12:12:21 -0300
> >
> >Or even using the PostGreSQL (the sql basic syntax isn't that diferent
> >neither)
> >See, I'm using the console of Geronimo, and when I was creating the
> >database
> >pool, I was selecting in the Database type: Other
> >
> >In the postgresql it is possible to change all the parameter so it
> connects
> >to a firebird database, but doing this it will use the postgresql syntax
> ?
> >
> >Or I may saying completely stupid things right now.......
> >
> >Best Regards,
> >Olivier Voutat
> >
> >On 4/5/06, Olivier Voutat <olivier.voutat@gmail.com> wrote:
> > >
> > > Oh Gianny,
> > >
> > > May that be the reason why my findByPrimaryKey and getPrimaryKey are
> > > acting weird ?
> > >
> > > When I use the getPrimaryKey (I have ClassPK) instead of returning a
> > > ClassPK object, it gives me a String object. And the findByPrimaryKey
> > > doesn't work at all (data infomation in the end)
> > >
> > > Since the basic sql language in Firebird is the same in MS sql server,
> > > could I configure it using the db-syntax-factory of it ? Just changing
> >the
> > > path to the database and the driver ?
> > >
> > > Best Regards,
> > > Olivier Voutat
>
>
>


--
Olivier Jeanpierre Voutat
Rua Praia de Muriú, 9188
Cep 59092-390 / Natal - RN
Tel: (84) 3219-0427 Cel: (84) 9977-3917

Mime
View raw message