No, no such thing is required - just make the field be of the remote
interface type (ejbLoad/ejbStore is still empty) and it will be persisted as
the primary key of the entity in the db.
Have a nice day! :)
/Magnus Stenman, the Orion team
----- Original Message -----
From: "Micah Skilling" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Thursday, April 13, 2000 1:58 PM
Subject: Entity Bean with refs to other Entity Beans?
> I'm trying to understand what is required to effectively store
> CMP/entity beans that contain references to other CMP/entity beans. Is
> it necessary to put the storage and retrieval logic for references to
> other CMP/entity beans in the ejbLoad and ejbStore methods?
>
> For example:
>
> If I have a ApplicantEJB and it contains a ResidenceEJB (both EJBs are
> CMP). Should I put something similiar to the following in the ejbLoad
> method for ApplicantEJB:
>
> public void ejbLoad() throws RemoteException {
>
> file://residence is an instance variable of ApplicantEJB
>
> try {
> Context context = new InitialContext();
> ResidenceHome residenceHome = (ResidenceHome)
> context.lookup("java:comp/env/Residence");
> residence = residenceHome.findByPrimaryKey(this.id);
> if(residence == null) {
> System.out.println("Residence not found so creating new
> one");
> residence =
> (Residence)PortableRemoteObject.narrow(residenceHome.create(this.id),
> Residence.class);
> }
> }
> catch(Exception e) {
> throw new RemoteException(e.toString());
> }
> }
>
> Am I on the right track?
>
> Thanks,
>
> Micah Skilling.
>
> ps. Orion is a blast to work with.