5 Replies Latest reply on Apr 22, 2003 8:08 AM by milowe

    why doesnt ejbLoad() get called?

    milowe

      Basic set-up:
      JBoss 3.0.6
      Stateless bean calling a few Entity beans
      Tx: Required
      Commit : B

      My client connects to the session bean and executes some methods. The session bean is created and makes some calls to the entity beans.
      Every business method on the entity beans are
      surrounded by an ejbLoad() and ejbStore() calls.
      So far so good.

      The next time the client connects and executes the same sequence, only the ejbStore() calls appear when calling business methods on the entity beans.

      Is this because the session bean isnt created the second time? I guess its just grabbed from the pool. Shouldnt the context be refreshed signaling a new transaction and thereby getting the ejbLoad call as well?

      What am I doing wrong, anyone?

        • 1. Re: why doesnt ejbLoad() get called?

          Try changing TRACE logging to
          org.jboss.ejb

          I didn't fully follow your explanation, but it
          sounds like it is all in one transaction so
          the container is allowed to cache.

          Regards,
          Adrian

          • 2. Re: why doesnt ejbLoad() get called?
            milowe

            Maybe I was a bit unclear in my explaination.
            The setup is like this:
            client -> session bean -> entity bean.

            I am using commit option B for the container. If I remember right, it should ensure synchronization (ejbLoad & ejbStore) for each business method of the entity bean if they have "Required" as tx attribute. Although, ejbLoad would only be called at start of transaction.

            The first call from the client creates the session bean and the entity bean gets that its a new transaction going when called from session bean.

            After I disconnect and connects a second time I must still be in the same transaction...or?

            How do I get the transaction to end after first call is made? Isnt each business method a seperate transaction if managed by container?

            • 3. Re: why doesnt ejbLoad() get called?

              If you are using required, the session bean
              will start and end the transaction. The entities
              will run in the transaction of the session bean.

              If you are using BMT for the session bean
              you must remember to either commit or
              rollback.

              If the client starts the transaction then the
              data will remain cached until the client commits
              or rollbacks.

              Regards,
              Adrian

              • 4. Re: why doesnt ejbLoad() get called?
                milowe

                Well, I still havent got it to work as supposed to.

                I do use CMT for the session bean and I have tried
                "Required" and "RequiresNew" for all methods on session bean and entity bean.

                I will start from scratch again making a mini example
                and take it from there.

                Thanks for the help so far anyway.

                • 5. Re: why doesnt ejbLoad() get called?
                  milowe

                  Problem solved :)

                  I seemed to have been a bit sloppy extending
                  container-configuration in jboss.xml and missing the fact that there was more than one bean packed in that ejb-jar.xml.