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>
|