Sorry, I should have included this in the description.  This takes place in
a Session Bean and using WLS7.




|---------+--------------------------->
|         |           "Ritesh Gupta"  |
|         |           <mylists@postmar|
|         |           k.net>          |
|         |                           |
|         |           01/16/2003 09:09|
|         |           PM              |
|         |                           |
|---------+--------------------------->
  
>---------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                           |
  |        To:      "Justin Wesbrooks" <[EMAIL PROTECTED]>                         
                           |
  |        cc:                                                                         
                           |
  |        Subject: Re: Wierd CMR behavior                                             
                           |
  
>---------------------------------------------------------------------------------------------------------------|




Hi,

Can you tell where you are trying to do this updating (bean, helper class,
jsp ?)?

Ritesh
----- Original Message -----
From: "Justin Wesbrooks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 17, 2003 3:35 AM
Subject: Wierd CMR behavior


> I have a CMP (beanA) with a 1 to many relationship with beanB, so beanA
> instance has a collection of beanB's.  The following pseudocode is what I
> do.
>
>
//**************************************************************************

> //beanA.getBeanBs().size() equals 2 here
> //I have a temp collection of BeanBs that I need to compare to
> //the real collection in beanA.  If I compare one bean at a time,
> //as in the following...
>
> Iterator it = tmpColl.iterator();
> while(it.hasNext()){
>       BeanB beanb = (BeanB)it.next();
>         //The following prints out TRUE for every bean
>       System.out.println(beanA.getBeanBs().contains(beanb));
> }
>
> //so at this point, I know that all beans in the temp collection
> //are contained in the real collection
>
> //i want to keep all beans in the temp collection in the real
> //collection and remove all beans in the real collection that
> //aren't in the temp collection.
>
> beanA.getBeanBs().retainAll(tmpColl);
> System.out.println(beanA.getBeanBs().size());
> //This prints out "0" when it should print out 2  ????
>
//**************************************************************************

*
>
> I can't figure out why it's removing both beans from the real
> collection when I just verified they exist in both collections.  I feel
> like there is some behavior with the retainAll() method that
> I'm not aware of that's throwing me off.  In addition to this, even
> though all beanBs are removed from beanA when I call
> retainAll(), they still remain in the underlying database??
>
> Has anyone experienced this kind of behavior??
>
>
===========================================================================
> 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