You can represent master/detail relationships too. See How to use the
OR-mapping tool for CMP Entity beans for a very brief description.

The atm application uses it. You can unjar the ear and the ejb.jar to see the
source.

It seems that you MUST declare the containing attribute as one of the
collection interfaces. For instance I tried to have an ArrayList be container
managed. What I got was appearently the list serialized. When I switched to a
List, it worked.

Some more docs on this area would sure be nice.

[EMAIL PROTECTED] wrote:

> Gary Albers@TIMEWEB
> 04/13/2000 07:01 AM
>
> Wow, that is neat.   A few related questions:
>
> 1 - How do you do it for a collection of objects, (master / detail
> relationship).
> 2 - Are there any requirements placed on the primary key type of the object
> pointed to?
> 3 - Are there any examples of this in Orion distribution?
> 4 - Where is this documented?
> 5 - What do the ejb-jar.xml and orion-ejb-jar.xml files look like for each
> object type?
>
> Thanks,
> Gary Albers
> [EMAIL PROTECTED]
>
> "Magnus Stenman" <[EMAIL PROTECTED]> on 04/13/2000 04:49:18 AM
>
> To:   Orion-Interest <[EMAIL PROTECTED]>
> cc:    (bcc: Gary Albers/DDI)
> Subject:  Re: Entity Bean with refs to other Entity Beans?
>
> 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.


Reply via email to