3 Replies Latest reply on Jan 24, 2002 1:39 PM by jbossuser

    inheritance in EJB's /JBoss ??

    berndreiners

      Hi all
      I try to code an EntityBean that inherit (its dataFields) from another Class, but i get mistakes.
      In the EJB spec i read, that the behave of inheritance is buisiness of the ContainerProvider. Ok, now i read that in Jboss my Beans can inherit from whatever i want as long as i deklare it in the right way in the XML Files.
      My Questien is:
      What do i have to do to implement an inherit tree in EJB's for JBoss ??

      bernd

      P.S. the classes are: person -- member -- adminOfPArt -- Admin. So its frustrating to implement (that typicall Exapmple) that without inheritance :)

        • 1. Re: inheritance in EJB's /JBoss ??

          Are you using CMP 2.0?

          Entity beans persisted fields are declared as abstract methods, and you can't use the pattern of inheriting from a value object.

          • 2. Re: inheritance in EJB's /JBoss ??

            Hi 'jbossuser',

            You *can* define the abstract getters and setters in the EB class or any of it's supper classes.
            The EJB spec. (1.1 and 2.0) does not restrict the usage of inheritance, and I use inheritance with 2.0 cmp extensive.

            • 3. Re: inheritance in EJB's /JBoss ??

              Doh! God please give me patience.

              The "value object" pattern used in 1.1 was to have a value object that had properties, have your entity bean inherit from this value object so that you didn't have to re-declare the fields, and use the value object to pass back the collection of properties in one shot rather than one by one.

              With EJB 2.0, you must declare your properties as abstract methods, and thus, inheriting from the value object does not provide you anything.

              Sorry you needed this spelled out, but if you had read the origional post ayou would have seen that he was trying to inherit the datafields. Also, you would have seen that I said you can't use the "pattern of inheriting from a value object", not that you can't use inheritence.