Hibernate version:
3
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="src.Person" table="PERSONS">
<id name="id" type="long" column="uid">
<generator class="increment"/>
</id>
<property name="name" column="names" type="string"/>
<joined-subclass name="src.Student" table="STUDENTS">
<key column="uid"/>
<property name="grade" column="grade" type="integer"/>
<property name="sessionCount" column="sessions" type="integer"/>
<property name="level" column="boardLevel" type="integer"/>
<property name="position" column="boardPosistion" type="integer"/>
<map name="scores">
<key column="id"/>
<index column="gradeID" type="integer"/>
<element column="score" type="double"/>
</map>
</joined-subclass>
<joined-subclass name="src.Teacher" table="TEACHERS">
<key column="uid"/>
<property name="password" column="password" type="string"/>
</joined-subclass>
<joined-subclass name="src.BoardMember" table="BOARDMEMBERS">
<key column="uid"/>
<property name="password" column="password" type="string"/>
</joined-subclass>
</class>
</hibernate-mapping>
Hello. I have an inheritence model that has a "Person" as the Parent class and "Student"/"Teacher"/"BoardMember" as the sub-classes.
The student class contains an instance variable called "scores", which is a Map<Integer,List<Double>>. I cant seem to figure out how to setup the mapping file to accomodate the list of doubles as an element of the map.
Ive been reading about many-to-many and one-to-many associations but cant seem to wrap my head around how it would be useful in this situation.
If anyone could tell me how this mapping would be possible I'd appreciate it.
Thanks,
Andrew