I have two entity beans e.g. order and currency. The order has an attribute currency. Now I want to set the currency of the order but the order should only accept a currency existing in the currency bean (database table). So I have to search for the currency bean object and if I find it I can set the attribute of the order. Otherwise I throw an exception "currency does not exist...". In order to do this I have to guarantee that the currency object would not be deleted until the order object is updated. This is necessary because a currency object must not be deleted while it is used in any order.
How could I do that with CMP? I tried with standard configuratin but I was always able to delete the currency record in the database between searching and updateing.