0 Replies Latest reply on Aug 1, 2002 10:42 PM by Steve Buikhuizen

    BMP Entity Inheritance ejbLoad problem

    Steve Buikhuizen Newbie

      I tried for quite a while to build a logical set of
      BMP entity beans that subclassed in a vanilla java design.

      Most of these classes did not override the superclass primary key.

      When I tested them, I discovered that, even though the appropriate finders were used, the ejb load behaviour was not what I expected.

      e.g.

      bean a - primary key java.lang.Integer
      bean b extends a (adds finder methods and other methods but pk unchanged)

      when I used b's finders, I got lots of null pointer exceptions because the container did not invoke the ejbLoad method inherited from a. Even if I overrode the ejbLoad method, it was not called.

      In some way this makes sense to me since the container must compare these pk's using java equals() and they are the same object if inheritied.

      In the end, I gave up inheritance and implemented using the superclass as a data member, thus requiring me to duplicate all the inherited methods or use a getSuperObjectA() method.

      What I'm looking for is a way to make this work. Does anybody have any suggestions for me?