1 Reply Latest reply on Aug 18, 2001 10:41 AM by matthew borrigan

    SessionSynchronization and transactions

    Stefanie Tellex Newbie

      I am trying to use the SessionSynchronization interface on a stateful session bean so it can reload its state from the database. The afterCompletion method appears to be called when the transaction commits, but I have trouble reading the database from this method.
      If I hit the database (by calling findByPrimaryKey from an entity bean) from the afterCompletion method, it complains that the transaction has already been committed.
      If I force it to start a new transaction by doing the lookup from a session bean with a transaction attribute of RequiresNew, it sees the data from before the transaction commit; in this case, it does not find the row that I know the transaction inserted. (The insert statement was logged, and the data shows up in the database.)
      Is this a bug in JBoss? How can I be notified of transaction commits at a time when I can see the changes the transaction has made?

      Thanks for your help.