-->
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: Subclass mapping problem
PostPosted: Fri May 09, 2008 6:07 am 
Newbie

Joined: Fri May 09, 2008 5:56 am
Posts: 4
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:

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">
<!-- 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 :

Code:
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?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 09, 2008 6:47 am 
Newbie

Joined: Fri May 09, 2008 5:56 am
Posts: 4
I have found solution for this.
I just added all constructors from base class to User class and it works now.


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.