1 Reply Latest reply on Mar 11, 2005 7:34 PM by Bill Burke

    using @Version with @Inheritance

    Nikola Ivancevic Newbie

      Maybe this is a dumb question, but, is there any limitation using Version anotation with Inheritance (and InheritanceType.SINGLE_TABLE)?

      I have tried to figure out why the following (simple) example faild during deployment (JBoss 4.0.1, EJB3.0preview4):

      @Entity
      @Inheritance(strategy = InheritanceType.SINGLE_TABLE,
      discriminatorType = DiscriminatorType.STRING,
      discriminatorValue = "CAT")
      @DiscriminatorColumn(name = "SUBCLASS")
      public class Cat {
      private int id;
      private int version;
      private String color;

      @Id(generate = GeneratorType.AUTO)
      protected int getId() { return id; }
      protected void setId(int id) { this.id = id; }

      @Version
      protected int getVersion() { return version; }
      protected void setVersion(int version) { this.version = version; }
      }

      @Entity
      @Inheritance(discriminatorValue = "DOMESTIC")
      public class DomesticCat extends Cat {
      private String name;

      public String getName() { return name; }
      public void setName(String name) { this.name = name; }
      }

      This example works fine if Inheritance anotations are removed...