hi,

i've two classes that are linked to each other (bi-directional) using an
indeirection table. they are called "pharmacy" and "campaign", and pharmacy
has a method "List getCampaigns()" to retreive all campaigns it is in, and
campaign has a method "List getPharmacies()", which gives back the list of
pharmacies that participate in this campaign.

when i need to remove one pharmacy from a campaign, i do the following:

boolean campRemoveResult = campaign.getPharmacies().remove(pharmacy);
boolean pharmRemoveResult = pharmacy.getCampaigns().remove(campaign);

then i store both of the them to have my changes persistet. i can see in the
database that the entry in the indirection table has beem removed.

BUT: pharmRemoveResult is TRUE, but campRemoveResult = FALSE, and the list
"campaign.getPharmacies()" still contains the pharmacy i just removed.
so far i found out that the pharmacy object linked to the list in campaign
is somehow different to the pharmacy object i have during runtime. if i do a
toString() on the pharmacy i have and the pharmacy i found in the pharmacy
list of camaign (searched for the same primary key), the both have the same
object id and all the values AND references to other objects are the same.
still, the "equals()" method returns false.

pharmacy has "proxy=dynamic", and if i remove this, everything works fine.
but this is of course no solution for my problem.

anyone an idea how to successfully remove objects from a list if the only
object that should be removed has proxy=dynamic? am i doing something
fundamentally wrong here?


kr,
guenther

Reply via email to