Hi All,
I am having two tables 1)project 2)Phase
Project table contains:
projectId
projectName
startDate
endDate
Phase table contains :
projectId as foregin key
phaseId as primary key
phaseName
startDate
endDate
this is one to many relation i.e one project can contain N phases. How do i mention foergin as projectID in Phase class?
Code:
<hibernate-mapping>
<class table="project" name="com.vo.ProjectVO">
<id name="projectId" column="projectId" >
<generator class="increment"></generator>
</id>
<property name="projectName" column="projectName" />
<property name="startDate" column="startDate" type="date" />
<property name="endDate" column="endDate" type="date" />
</class>
<class table="phase" name="com.vo.PhaseVO">
<id name="phaseId" column="phaseId">
<generator class="increment">
</generator>
</id>
<property name="phaseName" column="phaseName"></property>
<property name="startDate" column="startDate" type="date" />
<property name="endDate" column="endDate" type="date" />
</class>
</hibernate-mapping>