Is there an annotation that allows subclasses to override the id mapping of the base class? For example you have an abstract base class:
Code:
@EmbeddableSuperclass
public abstract class BaseEntity {
private int id;
@Id(generate = GeneratorType.NONE)
public int getId() {
}
// Some logic using the id field.
}
And 2 concrete subclasses:
Code:
@Entity
public class NoAutonumbering extends BaseEntity {
}
@Entity
public class Autonumbering extends BaseEntity {
}
Most of the classes need to be mapped without sequences but some of them do use sequences in the database. I need a way to override the id mapping of the concrete Autonumbering class. I want it to be mapped using
@Id(generate = GeneratorType.AUTO). I tried using the @AttributeOverride annotation but this does not seem to help me for @Id annotations.