1 Reply Latest reply on Mar 17, 2008 6:38 AM by vickyk

    Completely confused JCA and Hibernate

    gsniderjboss

      My apologies. I've searched and searched. I'm confused about my current configuration for Hibernate.

      Basically we use Hibernate.getCurrentSession() to 'get' and 'save' information. We have CMT and an XA-datasource configured.

      Is Hibernate using any part of JCA for its work? (the example mysql-ds.xml was in the examples\jca directory). And if I want to use the WorkManager, what am I supposed to do? Is there some default RA to use with JBoss that already works with the WorkManager?

      Here is the use case:
      1) stateless EJB inserts a record into table A: (get the primary key from the insert)
      2) asynchronously do some 'work' that will use the PK from step 1 to insert into child table B

      The problem is
      1) TX1 is created for the insert
      2) TX2 is created by the WorkManager for the inserts into the child table B. But TX2 cannot see the changes made by TX1.

      I can set the isolation level to read uncommited but that is ridiculous. I think TX1 and TX2 should be able to see the changes and act as a coordinated transaction.

      It's just that this is trivial stuff and I can't imagine I need to write some RA just to do something this simple.

        • 1. Re: Completely confused JCA and Hibernate
          vickyk

           

          "gsniderJBoss" wrote:
          My apologies. I've searched and searched. I'm confused about my current configuration for Hibernate.

          Basically we use Hibernate.getCurrentSession() to 'get' and 'save' information. We have CMT and an XA-datasource configured.

          Is Hibernate using any part of JCA for its work? (the example mysql-ds.xml was in the examples\jca directory). And if I want to use the WorkManager, what am I supposed to do? Is there some default RA to use with JBoss that already works with the WorkManager?

          Here is the use case:
          1) stateless EJB inserts a record into table A: (get the primary key from the insert)
          2) asynchronously do some 'work' that will use the PK from step 1 to insert into child table B

          The problem is
          1) TX1 is created for the insert
          2) TX2 is created by the WorkManager for the inserts into the child table B. But TX2 cannot see the changes made by TX1.


          How are you starting the asynchrounous call ?
          So you would have flow like this
          Start TX
          Some Bussiness Logic
          Invoke AsynCall ---------------------> Will continue
          End TX
          AsyncCall -------> Ends later .(This can't have control of TX as that is ended earlier)

          Async Call should end before the END TX , then it would be useful.
          So asnchronous does not add value here .