Hi, I am trying to map subclass, but I am not sure if it should inherit my class or my generated class.
This is how my xml looks like:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 30, 2008 1:24:16 PM by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
<class name="com.bsc.ngpt.domain.User" table="USR" schema="NGPIN">
<meta attribute="generated-class" inherit="false">com.bsc.ngpt.domain.base.UserBase</meta>
<meta attribute="class-code">
<![CDATA[
public static final String ACTIVE_FILTER_NAME = "UserActiveFilter";
private static final long serialVersionUID = 0L;
]]>
</meta>
<id name="id" type="long">
<column name="USR_ID" precision="10" scale="0" />
<generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
<param name="table_name">id_generator</param>
<param name="segment_value">USR</param>
<param name="increment_size">100</param>
<param name="optimizer">pooled</param>
</generator>
</id>
<discriminator column="active" type="yes_no"/>
<property name="active" type="yes_no">
<column name="ACTV_IND" length="1" not-null="true" />
</property>
<subclass name="com.bsc.ngpt.domain.ActiveUser" discriminator-value="true" extends="com.bsc.ngpt.domain.base.UserBase">
</subclass>
</class>
</hibernate-mapping>
The problem is that my subclass has code like this :
public class ActiveUser extends com.bsc.ngpt.domain.User implements java.io.Serializable {
// Fields
// Constructors
/** default constructor */
public ActiveUser() {
}
/** minimal constructor */
public ActiveUser(String firstName, String lastName, String username, Boolean active, UpdateInfo updateInfo) {
super(firstName, lastName, username, active, updateInfo);
}
/** full constructor */
public ActiveUser(String firstName, String lastName, String username, String emailAddress, String phoneNumber, Boolean active, UpdateInfo updateInfo, Set userTaxIdentifiers, Set roles, Set queueLogs, Set teams, Set performanceGoals) {
super(firstName, lastName, username, emailAddress, phoneNumber, active, updateInfo, userTaxIdentifiers, roles, queueLogs, teams, performanceGoals);
}
// Property accessors
// The following is extra code specified in the hbm.xml files
public static final String ACTIVE_FILTER_NAME = "UserActiveFilter";
private static final long serialVersionUID = 0L;
// end of extra code specified in the hbm.xml files
}
and super constructors do not exist in the User class, they exist in generated UserBase class but my subclass does not inherit base class.
Can someone please help me?
|