2 Replies Latest reply on Nov 6, 2006 9:43 AM by fbadt

    CMP EntityManager flush and Dirty READ/WRITE

    fbadt

      We have a Stateless Session Bean that REQUIRES a new transaction for each of its methods. The session bean passes off work to several delegate objects that are also given a reference to the inject Entity Manager.

      These delegates do an em.flush to update the database (informix 9.4 with Datadirect type 4 drivers). This seems to result in rows showing up in the database that aren't committed and therefore would need to be read with a DirtyRead.

      ** 1 : how can the EM be setup to do dirty reads?
      ** 2 : the session bean methods are logical business methods and thus one transaction; however, it would be desireable to actually do sub transactions within them. How can this be done?

        • 1. Re: CMP EntityManager flush and Dirty READ/WRITE
          wolfc

          1: The delegates should be able to read back the data as long as they are in the same transaction.

          2: You could call other beans (or the same bean) via their business interface.

          • 2. Re: CMP EntityManager flush and Dirty READ/WRITE
            fbadt

            1. Looks like they can :)! The DBA (informix 9.4) indicated the connection was set for READ COMMITTED and the transaction was not yet committed however the trigger on insert would run prior to the commit. I just would not be able to get the data out of a table that was populated by the trigger (because its populated by the DB on the server side and part of the same uncommitted transaction.

            2. How would one session bean lookup and call another session bean?