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 = ?
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
Hopefully, others know how to get compound keys working with CMP. I still
would like to know.
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...
In the ejb-jar.xml...
<!-- your original stuff here...->
<!-- more of your original stuff -->
<!-- multiple declarations of cmp-field here -->
Your openejb-jar.xml should not have to change.
>From: "Olivier Voutat" < email@example.com>
>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
>See, I'm using the console of Geronimo, and when I was creating the
>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.......
>On 4/5/06, Olivier Voutat <firstname.lastname@example.org > 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
> > path to the database and the driver ?
> > Best Regards,
> > Olivier Voutat