The ReservationBean has a primary key that is built by
several other primary keys. In my opinion, that
fullfill also the container requirement for a unique
bean.

Please look at the code fragment form Richard's EJB
book:

package com.titan.reservation;

import com.titan.cabin.*;
import com.titan.cruise.*;
import com.titan.customer.*;

import javax.ejb.*;
import java.rmi.RemoteException;


public class ReservationBean implements
javax.ejb.EntityBean {

    public int customerID;
    public int cruiseID;
    public int cabinID;
    public double price;


    public javax.ejb.EntityContext ejbContext;

    public ReservationPK ejbCreate(Customer customer,
Cruise cruise, Cabin cabin, double price) {
        try {
            this.customerID =
((CustomerPK)customer.getPrimaryKey()).id;
            this.cruiseID =
((CruisePK)cruise.getPrimaryKey()).id;
            this.cabinID =
((CabinPK)cabin.getPrimaryKey()).id;
            this.price = price;
        }
        catch (RemoteException re) {
            throw new EJBException(re);
        }
        return null;
    }
...


When I run this in JBuilder I get this output:

"ReservationEJBeanGroup.ejbgrp": Entity Bean:
"ReservationBean" Could not find container-managed
field corresponding to primary key field: public int
com.titan.reservation.ReservationPK.id


Thanks for any assistance,

regards,
Darya




--- Ashwani Kalra <[EMAIL PROTECTED]> wrote:
> This is not a problem with the table not having the
> Primary key. But entity
> beans must have primary key even if your table does
> not have one.
> For what purpose you want to use the entity beans in
> this case ??
>
> ========================
> Regds
> Ashwani Kalra
> Aithent Technologies
> India
> ========================
> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans
> development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Darya
> Said-Akbari
> Sent: Wednesday, July 25, 2001 7:34 PM
> To: [EMAIL PROTECTED]
> Subject: How deploy an CMP entity bean without
> primary key?
>
>
> Hello,
>
> as I am still working through Richard
> Monson-Haefel's
> EJB book, I have now the problem that I want deploy
> a
> CMP entity bean but can't. The corresponding table
> do
> not have a primary key.
>
> Here is the output:
> "ReservationEJBeanGroup.ejbgrp": Entity Bean:
> "ReservationBean" Could not find container-managed
> field
> corresponding to primary key field: public int
> com.titan.cruisereservation.ReservationPK.id
>
>
> Is that a problem not having a primary key in a
> table?
>
>
> regards,
> Darya
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
>
===========================================================================
> 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".
>
>
===========================================================================
> 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".
>


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

===========================================================================
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