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".

Reply via email to