WebLogic 5.0xx examples show Container Managed Persistance Entity Beans
with.. String as a primary key. Well why not, String is serialisable...
fine. BUT :
I wanted to have an integer like primary key, not a string one, and I wanted
to have a class with PK at the end to represent that key.
My Bean is a customer with (for the moment) two simple fields : int id, and
String name.

CustomerPK (serialisable) has one field
        -> int id
Customer Home has :
        -> public Customer findByPrimaryKey(CustomerPK primaryKey) ...
        -> public Customer create(int id, String name) ...
Customer Bean has :
        ->
  public CustomerPK ejbCreate(int id, String name)
    throws CreateException,
           RemoteException
  {
    this.id = id;
    this.name = name;
    return new CustomerPK(id); // first (simplest) implementation, of
course.
  }

And the ejb-jar.xml says primary key is CustomerPK.
But now when I deploy (with weblogic.ejbc) the bean, Weblogic generates
CustomerBeanEOImpl class in which it tries to do : bean.id = pk   (int =
CustomerPK)....

of course int can't be a primary key class.. because it's not a class.
Should my id field be a CustomerPK ?? how can I then auto-map it to my
database ??
well in recap : HELP !!!!

Other questions :
- why must I do my container managed persistance field public ? I know that
the client will use the remote interface and never see the public field, but
it breaks something in me when I see public fields in a class :(. The EJB
specs orders so ? snif. why can't we make it just protected ?

- if I want to do a finder method which gives me the list of all customers,
what should be the syntax in the xml file ? should I write : '( id
isNotNull )' ? can I do '( true )' ?

Thanks for your help.
        Cyril.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to