geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale de los Reyes" <>
Subject Re: FindByPrimaryKey
Date Wed, 05 Apr 2006 23:14:02 GMT
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 

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...
   return null;

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" <>
>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.......
>Best Regards,
>Olivier Voutat
>On 4/5/06, Olivier Voutat <> 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

View raw message