8 Replies Latest reply on Jul 13, 2007 12:53 PM by azalea

    EntityHome and optimistic transaction

    azalea

      Hi,

      Now I struggle with EntityHome :)

      my environments:
      JBoss AS 4.2.0.GA
      Seam 2.0.0.BETA1(CVS)
      Seam gen-generated project(ear)

      I have a simple CRUD app using EntityHome.
      The app needs the optimistic transaction.

      Scenario:
      1. In browser tab#1, display the person list.
      2. In tab#1, select a person from the person list for editing.
      (1)the selected person id is bound to EntityHome.setId().
      (2)long-running conversation begins.
      (3)the view for editing the person information is rendered.
      3. In tab#2, display the person list.
      4. In tab#2, select the same person from the person list for deleting.
      (1)the selected person id is bound to EntityHome.setId().
      (2)long-running conversation begins.
      (3)the view for deleting is rendered.
      5. In tab#2, click "delete" button.
      (1)EntityHome.remove() is called.
      (2)long-running conversation ends.
      (3)now the person record doesn't exist in database table.

      Now If I click "edit" button after editing any entity attributes in tab#1,
      OptimisticLockException is thrown.
      Because the person record was deleted by tab#2, this is OK.

      But if I click "edit" button "without" editing any entity attributes in tab#1,
      OptimisticLockException is not thrown.
      And the following occur:
      -Any update SQLs don't seem to be executed.
      -However JSF message "successfully updated" added by EntityHome is displayed.

      How can I detect this situation in my app?

      Thanks in advance.