Quote:
Are you sure you told Hibernate to use both? Meaning, did you mention the mapping as well as the annotated child class in your Hibernate configuration?
If not so, could you post the mappings of the parent class and the code of the annotated class (fields and accessor methods should be sufficient).
Hi Forestel
Yes I have configuration in place for both mapping file and annotation class.
Please note that I am using single table for both parent .hbm file and child annotated class. I am sure I am missing some tag here but I am not sure as which tag to use to inherit the properties from .hbm file.
My Hibernate mapping file is as below:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.xyz.person" >
<class name="personDto" table="PERSON" abstract="true">
<id name="reqSequence" column="REQ_SEQUENCE">
<generator class="sequence">
<param name="sequence">REQUEST_SEQGEN</param>
</generator>
</id>
<discriminator column="REQUEST_TYPE"></discriminator>
<property name="createdBy" type="string" column="CREATED_BY" not-null="true" />
<property name="comment" type="string" column="COMMENT"/>
<property name="type" type="string" column="REQUEST_TYPE" insert="false" update="false" not-null="true"
/>
<property name="closedDate" type="timestamp" column="CLOSED_DT"/>
</class>
</hibernate-mapping>
My Annotated class is as follows:
Code:
@Entity
@Table(name = "PERSON")
public class UserDto extends PersonDto
{
@Column(name = "ADDRESS")
private String address;
@Column(name = "DEPARTMENT")
private String department;
public UserDto()
{
super();
}
public String getAddress ()
{
return address;
}
public void setAddress(String address)
{
this.address = address;
}
public String getDepartment ()
{
return department;
}
public void setDepartment(String department)
{
this.department = department;
}
}
Waiting for the reply.
Thanks in Advance