0 Replies Latest reply on Apr 11, 2006 12:13 AM by Richard C. L. Li

    EJB create after find Problem

    Richard C. L. Li Newbie

      I have come across a problem that generates a create after find race condition in a multi user enviornment:

      I have an Entity Bean whose pk is an self generated integer, but there is a field named 'refNo' which should be unique as well.
      When using this entity, there is a use case that need to synchronize the information of this entity from 2 servers.
      To sync the entity, a simple logic is used: find the entity using refNo, if not found -> create the entity; otherwise update the entity.
      This does not work when multiple thread is doing the same job, multiple Entities with same refNo is created sometimes.

      Has anybody meet this problem? Any workaround on this?