Let me give more info. I am on Wl6.1, ejb 2.0 , CMP bean.

1.From the replies can I conclude that even if I dont create accounts table
with cascade delete option (Oracle 8i) , and give the cascade option in
ejb-jar.xml, still the container will do the task for me. ( I will try this)
2. In 1-1 bidir relation ship, It should delete  account record when I
delete Customer record and vice-versa. But its not working (in case I delete
a account row) because may be I have not created the customer table with
cascade delete option. I have used cascade option in ejb-jar.xml on both
sides.

Regds
Ashwani


----- Original Message -----
From: "Krishnan Subramanian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 8:22 PM
Subject: Re: ejb Relation ships


> Juan,
>
> Assuming a master-detail relationship between two beans, couldn't
> all the details (that is, children) be deleted in the ejbRemove()
> of the master (that is, the parent)? That is, simply calling the
> ejbRemove() on each of the children from within the parent's
> ejbRemove().
>
> In EJB 2.0, this is what happens under the covers when you use the
> cascade-delete flag; but assuming you wanted to do something similar
> programatically (pre EJB 2.0), the above technique should work.
>
> Note that programmatic delete using CMP might run into issues if
> the Container defers the database delete(s).
>
> Some (pre) EJB 2.0 containers and persistence managers detect this
> automatically and reorder the SQLs; but the point is moot in EJB
> 2.0 if you set the cascade-delete behavior for relationships.
>
> -krish
> Borland
>
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Juan Pablo Lorandi
> > Sent: Tuesday, July 09, 2002 4:34 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: ejb Relation ships
> >
> >
> > Correction; the last post may not work properly:
> >
> > public class SingleBean implements EntityBean {
> >
> >         private  javax.ejb.EntityContext  entityContext = null;
> > .....
> >
> >         public void setEntityContext(EntityContext entityContext)
> >         throws java.rmi.RemoteException {
> >
> >                 this.entityContext = entityContext;
> >     }
> >
> > .....
> >
> >         public void removeMe() {
> >                 file://cascade-delete
> >                 Collection otherBeans =
> > otherBeanHome.findBySingle(this.getPrimaryKey() );
> >                 for (Iterator it = otherBeans.iterator(); it.hasNext();
> > ) {
> >                         OtherBean otb = (OtherBean) it.next();
> >                         otb.remove();
> >                 }
> >                 file://remove this bean
> >                 entityContext.getEJBObject().remove();
> >         }
> >
> > }
> >
> > Juan Pablo Lorandi
> > Chief Software Architect
> > Code Foundry Ltd.
> > [EMAIL PROTECTED]
>
> > Barberstown, Straffan, Co. Kildare, Ireland.
> > Tel: +353-1-6012050  Fax: +353-1-6012051
> > Mobile: +353-86-2157900
> > www.codefoundry.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".

Reply via email to