Discussions

EJB programming & troubleshooting: CMP 2.0 and Inheritance

  1. CMP 2.0 and Inheritance (3 messages)

    Being relatively new to EJB Programming, i have the following questions:

    Is it possible to have Classes which implement the EntityBean interface in a inheritance tree using CMP 2.0?

    Like

    public class A {}
    public abstract class B extends A implements EntityBean {}
    public abstract class C extends A implements EntityBean {}

    where B and C provide a abstract interface for CMP 2.0

    or

    public abstract class A implements EnitityBean {}
    public abstract class B extends A {}
    public abstract class C extends A {}

    where A, C and C provide a abstract interface for CMP 2.0

    And if yes, what does this mean for the can one implement different table mapping strategies? Like all in the same table, or all in seperate tables?

    Bare with me, if this is a too obvious question, i just did'nt find anything about this topic, neither in the web nor in books i have.

    Thanks,

    Christoph

    Threaded Messages (3)

  2. CMP 2.0 and Inheritance[ Go to top ]

    Yes, you can do that. Of course, both "strategies" must be deployed as separate entity beans with their own names in their own deployment units.
  3. CMP 2.0 and Inheritance[ Go to top ]

    But can "map" to for instance the same table name?
  4. CMP 2.0 and Inheritance[ Go to top ]

    I see no problem with this. However if both versions are working concurrently, database locks can be an issue...