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: 4 Table Design Question. Need some advice.
PostPosted: Fri Sep 21, 2007 12:50 pm 
Newbie

Joined: Fri Sep 14, 2007 8:51 pm
Posts: 12
Location: North Carolina
I working on a project that has 4 tables (for now)
People (maps to a Person class)
- stores the Users of my system
Skills (maps to a Skill class)
- stores a skill name and description
Strengths
- stores a strength id/value (1 to 5) and a description of what each level means
PeopleSkillsStrengths
- ties my People to their Skills and the Strength level of that skill

Through a previous question I was able to get my many-to-many relationship working between People and Skills through the table PeopleSkillsStrengths.

My problem is when I want to work with a Person class:
a) I want to lazy load the Skills of that Person. (solved)
AND
b) I would like to be able ask for the strength id and description from this <set> collection without building out a Strength class. How do I begin to approach this? I get the many-to-many thing but not when I have this extra information of a rating, a level, or an additional id. What is the right way to handle this if I did want to build out a Strength class?

below is my Skills.hbm.xml

btw, this forum has been extremely helpful over the last few days.
thanks,
kellygreer1


Hibernate version: 2.2
Mapping File:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="Doa.Domain.Entities" assembly="Doa.Domain">
<class name="Skill" table="Skills">
<id name="Id" column="id" type="Int32" unsaved-value="-1"
access="field.camelcase-underscore">
<generator class="native" />
</id>
<property name="Name" column="skill_name" type="string" length="200" access="field.camelcase-underscore">
</property>
<property name="Strength" column="strength_id" type="int" access="field.camelcase-underscore">
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 24, 2007 10:13 am 
Newbie

Joined: Fri Sep 14, 2007 8:51 pm
Posts: 12
Location: North Carolina
I think I am going to take the table PeopleSkillsStrengths and map that to a SkillInventory object and then establish many-to-one relationships back to a Person class, a Skill class, and a Strength class. Didn't have any other ideas this weekend and how to handle the issue.

Any other ideas guys?

Thanks,
kellygreer1


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.