-->
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.  [ 3 posts ] 
Author Message
 Post subject: question related to mapping Hibernate file and super class a
PostPosted: Tue Jan 17, 2006 1:22 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>


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

thanks in advance loking for your kind response


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 17, 2006 2:33 am 
Beginner
Beginner

Joined: Mon Aug 15, 2005 11:09 pm
Posts: 23
Unfortunately no. At the moment any mapping you define must have a single concrete storage location for each column.

I agree that it would be tremendously useful to have abstract or interface mappings. For example in my schema I have ICommentable, and ICalenderable interfaces on several of my business entities. Still I can just image how large the overhead would be to support it. So I can see why it isn't included.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 17, 2006 5:34 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
ganesh pol wrote:
hibernate 3
...


You posted to a wrong forum, this is the NHibernate forum.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.