Juan, I have done something very similar in my implementation, just as one
has findBy(OtherBean), I also add a home method called removeBy(OtherBean).
Then, inside of my ejbRemove() i simply call on
otherBeanHome.removeBy((OtherBean)getEntity().getEJBObject()).  I don't
really rely on cascading deletes.

-AP_
http://www.myprofiles.com/member/profile/apara_personal

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Juan Pablo Lorandi
Sent: Tuesday, July 09, 2002 7:28 AM
To: [EMAIL PROTECTED]
Subject: Re: ejb Relation ships


public class SingleBean implements EntityBean {

.....

        public void removeMe() {
                //cascade-delete
                Collection otherBeans =
otherBeanHome.findBySingle(this.getPrimaryKey() );
                for (Iterator it = otherBeans.iterator(); it.hasNext();
) {
                        OtherBean otb = (OtherBean) it.next();
                        otb.remove();
                }
                this.remove();
        }

}

Wouldn't that work?

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


> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]] On Behalf Of Sreenivsa Majji
> Sent: Tuesday, July 09, 2002 3:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: ejb Relation ships
>
>
> According to the original poster it's a CMP. How you can do
> this by programmatically?
>
> Sreenivasa Kumar Majji
>
>
>
>                     Ramakrishna N
>                     <nramakrishna@VIR        To:
> [EMAIL PROTECTED]
>                     TUSA.COM>                cc:
>                     Sent by: A               Subject:     Re:
> ejb Relation ships
>                     mailing list for
>                     Enterprise
>                     JavaBeans
>                     development
>                     <EJB-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     07/09/02 07:36 PM
>                     Please respond to
>                     Ramakrishna N
>
>
>
>
>
>
> I dont think this is a requirement in the ejb2.0 specs and
> hence the end user cannot expect this from the Application
> Server. The only way to have this done programatically is by
> implementing a callback mechanism( this is a cleaner way of
> having that feature if it ever creeps
> in) and that case it would be real tough since there can be
> more than one relationship for a Bean and for each one we
> need to give the cascade option. Now how does one do that. I
> dont say its impossible. I think  this seems to be like a
> nice feature as of now. Lets see what others have to say on this.
>
> Regards,
> kris
>
> -----Original Message-----
> From: Sreenivsa Majji [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 6:51 AM
> To: [EMAIL PROTECTED]
> Subject: Re: ejb Relation ships
>
>
> What about programmatically do cascade delete in the bean itself?
>
> Sreenivasa K Majji
>
>
>
>                     Ashwani Kalra
>                     <[EMAIL PROTECTED]        To:
> [EMAIL PROTECTED]
>                     NT.COM>                  cc:
>                     Sent by: A               Subject:     ejb Relation
> ships
>                     mailing list for
>                     Enterprise
>                     JavaBeans
>                     development
>                     <EJB-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     07/09/02 04:18 PM
>                     Please respond to
>                     Ashwani Kalra
>
>
>
>
>
>
> Hi,
>
> I have two questions
> 1. Is there any way in which application server should manage
> the cascade deletion without the help of database. i.e.  for
> e.g cutomer --has-- accounts (1to many) I dont want to create
> accounts table with cascade option of db.
>
> 2. In case of 1-1 relation ship(bidirectional)
> eg  customer has account or  account has customer
> if I deleted customer(customer.remove) then account row
> should be deleted or If I say account.remove then its
> associated customer is deleted. Is it possible ??
>
> ==============================================================
> =============
> 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".
>
>
>
>
>
>
> *****************************  DISCLAIMER  ***************************
>
> This message is confidential to the company, and is intended
> only for the named recipient. It may also be privileged or
> otherwise protected by work product immunity or other legal
> rules. If you are not the intended recipient, you are
> requested to delete this mail and also be notified that
> disclosing, copying, distributing or taking any action in
> reliance on the contents of this mail is strictly prohibited.
> The company accepts no liability for any damage caused by any
> virus transmitted by this email.
>
> **********************************************************************
>
> ==============================================================
> =============
> 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".
>
>
>
>
>
>
> *****************************  DISCLAIMER  ***************************
>
> This message is confidential to the company, and is intended
> only for the named recipient. It may also be privileged or
> otherwise protected by work product immunity or other legal
> rules. If you are not the intended recipient, you are
> requested to delete this mail and also be notified that
> disclosing, copying, distributing or taking any action in
> reliance on the contents of this mail is strictly prohibited.
> The company accepts no liability for any damage caused by any
> virus transmitted by this email.
>
> **********************************************************************
>
> ==============================================================
> =============
> 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".

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