1 Reply Latest reply on Aug 11, 2005 4:37 AM by Emmanuel Bernard

    @EmbeddableSuperclass

    Khalid Hajsaleh Newbie

      Is there a good example of using @EmbeddableSuperclass with an abstract parent class?

      I am having problems accessing attributes from the parent class in my subclass.

      Here is the code:

      @EmbeddableSuperclass(access=AccessType.FIELD)
      @Table(name="Item")
      public abstract class AItem implements IItem{
       @Id
       int id;
       @Column(name="name")
       String name;
      
       public abstract int getId();
       public abstract void setId(int id);
       public String getName() {
       return name;
       }
       public void setName(String name) {
       this.name = name;
       }
      }
      
      
      @Entity
      @Table(name = "ITEM")
      @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
      public class ItemHSQL extends AItem implements Serializable
      {
       final String CLASS_NAME="ItemHSQL";
      
       public ItemHSQL(){};
       public ItemHSQL(String name, double value)
       {
       this.name=name;
       this.value = value;
       }
      
       @Id(generate = GeneratorType.AUTO)
       public int getId ()
       {
       return id;
       }
      
      }


      The attribute name is not mapped to any column in the table. Any suggestions?