-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @MappedSuperclass question
PostPosted: Mon Jan 14, 2008 10:49 am 
Newbie

Joined: Mon Jan 14, 2008 10:41 am
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 14, 2008 2:03 pm 
Newbie

Joined: Mon Jan 14, 2008 10:41 am
Posts: 2
A more thorough search has uncovered that what I need is not currently supported by the tool:

http://forum.hibernate.org/viewtopic.ph ... nheritance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.