I'm new to Hibernate and annotations. I've created a few persistent POJOs that extend from an abstract class which in itself contains id and timestamp properties. The abstract and concrete class looks like this:
public abstract class AbstractPOJO {
protected long id;
protected Date timestamp;
@Id
public long getId() {
return id;
}
@Column(name="timestamp")
public Date getTimestamp() {
return timestamp;
}
// corresponding setter methods
}
@Entity
@Table(name="P_POJO")
public class PersistentPOJO extends AbstractPOJO {
protected String name;
@Column(name="pojo_name")
public String getName() {
return name;
}
// corresponding setter methods
}
Now when I have hibernate create the DB schema for me, it creates the P_POJO table with the "pojo_name" column but no timestamp or id columns. Is there a way to have hibernate also create the superclass's columns as well, or must I scrap the abstract class and copy/paste the id and timestamp properties in each persistent POJO? I would hate to do the latter. Thanks.
--Larry
|