I am moving from xdoclet to hibernate annotations. My Class hierarchy goes like this.
Code:
@MappedSuperclass
public abstract class Model implements Serializable {
private Long UID;
@Id @GeneratedValue(strategy=GenerationType.Sequence)
public Long getUID() {
return UID;
}
/*
other shared data
*/
}
@Entity
@Table(name="ADDRESS")
@SequenceGenerator(
name="ADDRESS_SEQ"
sequenceName="ADDRESS_SEQ"
allocationSize=1)
public class Address extends Model {
/*
other mapped data
*/
}
@Entity
@Table(name="PERSON")
@SequenceGenerator(
name="PERSON_SEQ"
sequenceName="PERSON_SEQ"
allocationSize=1)
public class Person extends Model {
/*
other mapped data
*/
}
The question is can I have a base class annotate the id and have individual sequences generate the id? By looking at the log output everything seems to be set up correctly but inserts fail because it is still looking for "hibernate_sequence".