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 my Design
PostPosted: Mon Mar 15, 2010 5:33 pm 
Newbie

Joined: Mon Mar 15, 2010 4:59 pm
Posts: 1
I need help mapping my design, I'm also open to suggestions for changing my design.

Objects
    Employee has UserID(PK), Login, Password, Level(int)
    Agent has UserID(PK), Login, Password, ParentAgentID, Prefix(string)
    Client has UserID(PK), Login, Password, ParentAgentID, Balance (decimal)

C# .NET
Code:
    public class User
    {
        public int UserID { get; set; }
        public string LoginName { get; set; }
        public string Password { get; set; }
    }
    public class ExternalUser : User
    {
        public int ParentAgentID { get; set; }
    }
    public class Agent : ExternalUser
    {
        public string Prefix { get; set; }
    }
    public class Client : ExternalUser
    {
        public decimal Balance { get; set; }
    }
    public class Employee : User
    {
        public int Level { get; set; }
    }


Mapping file:
Code:
  <class name="UserA">
    <id name="UserID">
      <generator class="native"/>
    </id>
    <property name="LoginName" />
    <property name="Password" />
    <joined-subclass name="Employee">
      <key column="UserID"/>
      <property name="Level" />
    </joined-subclass>
    <joined-subclass name="ExternalUser">
      <key column="UserID"/>
      <property name="ParentAgentID" />
      <joined-subclass name="Agent">
        <key column="UserID"/>
        <property name="Prefix" />
      </joined-subclass>
      <joined-subclass name="Client">
        <key column="UserID"/>
        <property name="Balance" />
      </joined-subclass>
    </joined-subclass>
  </class>

Does this seem right? I feel like I'm missing some basic things, but not sure.


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.