0 Replies Latest reply on Sep 11, 2006 5:31 AM by Rene Curth

    Version checks against non-existent objects

    Rene Curth Newbie

      Hi everybody,
      please forgive me, if I'm asking this question for the 10201th time, but I'm really new to this stuff.

      I've got some Entity-Beans, which are transferred to a couple of Swing clients. These beans are then existing as POJO's unmanaged on the clients. If one of these clients is removing an entity, a session bean will remove it on the server. The other clients still have the correspondending POJO. If another client will operate on this POJO, e.g. rename its caption, and is then updating it via a session bean (entityManager.merge()), a new entity will be created (standard procedure of merge()).

      It seems like there are no version checks against non-existent objects, I was expecting something like an exception: 'Now way, dude, entity was removed before'.

      Am I missing something, or have I to do a check manually (i.g. with a special boolean 'removed' column, which has to be checked every time - what a pain)?

      Any help is highly appreciated. Thanks in advance.

      Rene

      P.s.: I'm using optimistic locking with @version and @Id @GeneratedValue.