Hi,
I am trying to use hibernate tools to reverse engineer POJOs that derive some of their attributes from a common base class;
I have the following super class:
pakage foo.domain;
@MappedSuperclass
public abstract class PersistentObject implements Serializable {
private String createId;
private Date createDt;
@Column(name = "CREATE_ID", length = 10)
public String getCreateId() {
return this.createId;
}
public void setCreateId(String createId) {
this.createId = createId;
}
@Temporal(TemporalType.DATE)
@Column(name = "CREATE_DT", length = 7)
public Date getCreateDt() {
return this.createDt;
}
public void setCreateDt(Date createDt) {
this.createDt = createDt;
}
}
My reverse engineering file:
<hibernate-reverse-engineering>
<type-mapping>
<sql-type jdbc-type="NUMERIC" not-null="true"
hibernate-type="java.lang.Long" length="10" scale="0" />
</type-mapping>
<!-- BIN$ is recycle bin tables in Oracle -->
<table-filter match-name="BIN$.*" exclude="true" />
<table-filter match-schema="TEST" match-name=".*">
<meta attribute="extends">foo.domain.PersistentObject</meta>
</table-filter>
</hibernate-reverse-engineering>
I did not expect to find the inherited attributes in the generated POJOs. But they are:
@Entity
@Table(name = "TEMAIL_ADDR", schema = "SACWIS")
public class TemailAddr extends
foo.domain.PersistentObject
implements java.io.Serializable {
private long emailAddrId;
private String createId;
private Date createDt;
public TemailAddr() {
}
public TemailAddr(long emailAddrId) {
this.emailAddrId = emailAddrId;
}
@Id
@Column(name = "EMAIL_ADDR_ID", unique = true, nullable = false, precision = 10, scale = 0)
public long getEmailAddrId() {
return this.emailAddrId;
}
public void setEmailAddrId(long emailAddrId) {
this.emailAddrId = emailAddrId;
}
@Column(name = "EMAIL_ADDR", length = 50)
public String getEmailAddr() {
return this.emailAddr;
}
public void setEmailAddr(String emailAddr) {
this.emailAddr = emailAddr;
}
@Column(name = "CREATE_ID", length = 10)
public String getCreateId() {
return this.createId;
}
public void setCreateId(String createId) {
this.createId = createId;
}
@Temporal(TemporalType.DATE)
@Column(name = "CREATE_DT", length = 7)
public Date getCreateDt() {
return this.createDt;
}
public void setCreateDt(Date createDt) {
this.createDt = createDt;
}
//Other stuff omitted
}
Is this the correct behavior or I am missing a setting somewhere.
Any help would be appreciated.
|