0 Replies Latest reply on Apr 22, 2005 6:32 AM by epbernard

    Annotation inheritance

    epbernard

      Actually there will be a new concept in the next EJB3 draft, which will allow you to share some annotations between different entities provided that they share a common superclass and that this superclass is *not* an entity

      So basically


      public class WidgetBase {
       @Column(name="column")
       public String property1;
      }
      
      @Entity
      public class MyWidget extends BaseWidget {
       @Id(generate=GeneratorType.AUTO)
       public Integer id;
      
       @Column(name="column2")
       public String property2;
      }

      MyWidget will persist id, property1 and property2 in one table. not that WidgetBase is not an entity.
      But you won't be able to override @Id if the id property is held by the BaseWidget. Does it solve your problem?