1 Reply Latest reply on Dec 3, 2003 7:28 AM by sysuser1

    ejbLoad() not called after activation of CMR bean?

    fran26

      I have a problem accessing the data of a related entity bean, scenario is the following:
      Entity Bean A is related to entity bean B,
      A has an accessor method getB(),
      both beans are CMP and getB() is defined as CMR.

      When I call getB() I get back the activated bean but it seems that the ejbLoad() of this bean was not called.

      The reason why I am thinking this is that I calculate some internal fields of the bean in ejbLoad() and have methods for accessing these fields. In the above scenario I always get back null for these calculated fields.

      However when I access bean B directly by a finder method these fields are populated.

      Oh yes, I am using JBoss 3.2.1.

      Any hints on this?

        • 1. Re: ejbLoad() not called after activation of CMR bean?
          sysuser1

          I have the exact same problem as you. I can't believe JBoss can't be spec-compliant after so many months!
          Anyway, here are two solutions that worked for me:
          - use the "Instance Per Transaction CMP 2.x EntityBean" container configuration

          - lazily compute the internal fields when they are first accessed, and reset them to null in ejbStore, to make sure an incorrect cached value is not used in the next transaction.