2 Replies Latest reply on Apr 8, 2006 7:11 AM by wauwau0977

    conceptual: how start async job which relies on entities com

    wauwau0977

      hello there. a conceptual question:

      i have a stateless session bean which processes and writes some entities. i want to start a jboss message driven POJO which performs some calculations which take very long and are not important for the bean.

      the problem: at the moment where the async bean is started by the bean, the entites are not commited yet, but my async job relies on the current data!

      how can i solve it? best for would be, to "manual" commit the transaction in the bean. but i did not succeded to do that. any ideas?

      regards and thx for any help
      patrick heusser

      --
      patrick heusser, switzerland, http://www.x8ing.com/fractal/

        • 1. Re: conceptual: how start async job which relies on entities
          ejb3workshop

          You migth want to explain where you failed. Calling the message driven bean once the session bean is finnished should be possible. If there are a lot of other bean involved in the transaction, it could delay the final commit further. Maybe explain the complete transaction from the end-client perspective.

          Also take a look at the EntityManager services, in partuclar the flush method might be of interest.

          Alex
          ejb3workshop.com

          • 2. Re: conceptual: how start async job which relies on entities
            wauwau0977

            hi

            thx for your intput. it's exactly as you expected it, the bean later calls other beans, within the same transaction. at this point, the async bean already startet with the work.

            i think, that the EntityManger.flush() method does not help me, because the date is transfered to the DB, but not commited, and therefore not visible for the message driven POJO.

            at the moment my solution is to use "bean managed transaction" @TransactionManagement(TransactionManagementType.BEAN) , which is not so nice, because i need to control the whole bean no myself...

            best for me would be the normal JTA container managed transaction with a little "extra" rule, to sometimes make a programmatic commits....

            patrick