-->
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.  [ 1 post ] 
Author Message
 Post subject: mapping superclass attributes and subclass and mapping xml
PostPosted: Tue Jan 17, 2006 6:07 am 
Newbie

Joined: Tue Jan 17, 2006 1:02 am
Posts: 6
Location: mumbai,india
hibernate 3

oracle 9i data base


problem is as follows

public abstract class AbstractEntity
private Long addUserId = null;
private Date addDate = null;
private Long editUserId = null;
private Date editDate = null;


public class UserModel extends AbstractEntity {
private Long userId ;
private Date dateOfBirth = null ;
private double userTelephone ;
private String userTitle = "";
private String firstName = "";
private String lastName = "";
private String userLocation = "";
private String userName = "" ;
private String userPassword = "";
private String userJobTitle = "" ;
private String userEmail = "" ;
private int userSex ;
private int userMaritalStatus ;
private String userAddress = "" ;
private String userAddressType = "" ;
private Date dateOfJoining = null ;
private int isProjectManager ;
private int isDeleted;


public class ExpenseModel extends AbstractEntity {
//private Long expenseId=null;
private double submittedAmount=0.00;
private double approvedAmount=0.00;
private double rejectedAmount=0.00;
private int expenseStatus=0;




<class name="com.dss.ems.models.UserModel" table="DBUSER">
-
<id name="id" column="USERID">
<!--changed some time before from userId-->
<generator class="increment"/>
</id>
<property name="dateOfBirth" column="BIRTHDATE"/>
<property name="userTelephone" column="TELEPHONE"/>
<property name="userTitle" column="TITLE"/>
<property name="firstName" column="FIRSTNAME"/>
<property name="lastName" column="LASTNAME"/>
<property name="userLocation" column="LOCATION"/>
<property name="userName" column="LOGINNAME"/>
<property name="userPassword" column="USERPASSWORD"/>
<property name="userJobTitle" column="JOBTITLE"/>
<property name="userEmail" column="EMAIL"/>
<property name="userSex" column="SEX"/>
<property name="userMaritalStatus" column="MARITALSTATUS"/>
<property name="userAddress" column="ADDRESS"/>
<property name="userAddressType" column="ADDRESSTYPE"/>
<property name="dateOfJoining" column="DATEOFJOINING"/>
<property name="isProjectManager" column="ISPROJECTMANAGER"/>
<property name="isDeleted" column="ISDELETED"/>
<property name="addUserId" column="ADDUSERID"/>
<property name="addDate" column="ADDDATE"/>
<property name="editUserId" column="EDITUSERID"/>
<property name="editDate" column="EDITDATE"/></class>


<hibernate-mapping auto-import="true" default-lazy="false">
-
<class name="com.dss.ems.models.ExpenseModel" table="DBEXPENSE">
<!--attribues from AbstractEntityModel-->
-
<id name="id" column="EXPENSEID">
<generator class="increment"/>
</id>
<property name="isDeleted" column="ISDELETED"/>
<property name="addUserId" column="ADDUSERID"/>
<property name="addDate" column="ADDDATE"/>
<property name="editUserId" column="EDITUSERID"/>
<property name="editDate" column="EDITDATE"/>
<!--
attributes added in subclass-->
<property name="submittedAmount" column="SUBMITEDAMOUNT"/>
<property name="approvedAmount" column="APPROVEDAMOUNT"/>
<property name="rejectedAmount" column="REJECTEDAMOUNT"/>
<property name="expenseStatus" column="EXPENSESTATUS"/>
</class>


[color=cyan]in this case while defining mapping files for UserModel and ExpenseModel
i have to do mapping for AbstractEntity in both mapping files (mapping parameters from abstract class) is there is any way by which i can define variables from superclass at one place and later on reuse it in defining my subclass mapping files
[/color]thanks in advance loking for your kind response


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

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.