Actually I am calling 'remove' only once for BeanA. The "cascade delete" takes care of iteration. I had to set 'cascade delete' only on BeanB.
>-- Original Message -- >Date: Mon, 20 Jan 2003 12:33:54 -0800 >Reply-To: Justin Wesbrooks <[EMAIL PROTECTED]> >From: Justin Wesbrooks <[EMAIL PROTECTED]> >Subject: Re: Relationship deletion question >To: [EMAIL PROTECTED] > > >I have tried the <cascade-delete/> setting with no difference in results. > >I don't call remove on each individual bean because I don't want to have >to >iterate through >the collection when one call should do what I need it to (and does in the >other instance). > >Thanks > > > >|---------+------------------------------> >| | "Ajay Chitre" | >| | <ajay.chitre@dilige| >| | ntteam.com> | >| | | >| | 01/20/2003 12:29 PM| >| | Please respond to | >| | Ajay.Chitre | >| | | >|---------+------------------------------> > >>---------------------------------------------------------------------------------------------------------------| > | > | > | To: "Justin Wesbrooks" <[EMAIL PROTECTED]>, >[EMAIL PROTECTED] > | > | cc: > | > | Subject: RE: Relationship deletion question > | > >>---------------------------------------------------------------------------------------------------------------| > > > > >Justin, > >Have you tried setting <cascade-delete/> on BeanB? If you haven't, can >you please try and tell us what happens. > >Also, try 'beanA.remove()' as opposed to 'beanA.getBeanBs().clear()'. > >This works for me for '1:N relationships'. > >Thanks. > >>-- Original Message -- >>Date: Mon, 20 Jan 2003 11:20:18 -0800 >>Reply-To: Justin Wesbrooks <[EMAIL PROTECTED]> >>From: Justin Wesbrooks <[EMAIL PROTECTED]> >>Subject: Relationship deletion question >>To: [EMAIL PROTECTED] >> >> >>AppServer: WLS 7.0 >> >>I have 2 beans with a 1:N relationship. BeanA has a Collection >>of BeanB. I try to call BeanA.getBeanBs().clear(). All items >>are removed from the Collection, however, nothing is removed >>from the underlying database. I have another situation similar to >>this one and the exact same call works. I'll highlight the differences >>in the 2 below. >> >>Working situation >>===================== >>True M:N relationship with CMP (as outlined in Ed Roman book). >>String as primary key (no primary key class) >>clear() removes all records from the association table. >> >>Non-working situation >>===================== >>1:N relationship >>The collection class has compound PK class. >>The collection class also has a M:1 relationship with another CMP bean. >>(This is kind of like the "Fake M:N relationship described in the Ed Roman >>book) >> >>Both of these calls are made in a Stateless Session bean. Can >>someone point me to some literature on this or provide any insight?? >> >> >=========================================================================== >>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". > Ajay Chitre Diligent Team, Inc. (Where Diligent People Work as a Team) http://www.DiligentTeam.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".
