Using Hibernate 2.1
I have the mapping document as below
---------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="com.bellsouth.moquin">
<class name="Member" table="TEAM_MEMBER">
<id name="MEMBER_ID" type="int">
<generator class="native"/>
</id>
<property name="full_name" type="string"/>
<map name="weeklyTasks" lazy="true" table="WEEKLY_TASKS" sort="natural">
<key column="MEMBER_ID"/>
<index column="WEEK" type="string"/>
<element type="string" column="DUTIES"/>
</map>
</class>
</hibernate-mapping>
---------------------------
( I ve snipped some parts irrelevent to the context )
Essentially it is modeling a team, with each members given responsibilities for every week.
The Parent class has the team members personal data and then the map, inside will have the week-responsibilities relations.
1. How can I write a query that, given the week, will fetch the responsibilities of each team member for that week.
2. I wanted to use the value type for the inner week-responsibilities map. How will I write the mapping document for this ( using component ? )
3. Given the problem statement above, is there a better/natural mapping document
Thanks for reading
--sony
|