0 Replies Latest reply on Jul 4, 2008 5:29 AM by Thomas Hamacher

    Override @Id with different generators

    Thomas Hamacher Novice

      Hi,

      is there a chance to override the defined generator for the @Id?
      For example if I´d like to define the @Id in a superclass and only change the value of the db-sequence to use?

      For example something like this:

      @MappedSuperclass
      public class BaseEntity {
      
       @Id
       @GeneratedValue(generator="idGenerator")
       @SequenceGenerator(name = "idGenerator", sequenceName ="base_entity_id_seq")
       protected long id;
      
      ......
      }
      
      @SequenceGenerator(name = "idGenerator", sequenceName = another_id_seq")
      public class AnEntity extends BaseEntity {
      
      }


      Any input is greatly appriciated

      Thomas