<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">


<hibernate-mapping default-lazy="false" default-cascade="none">
    <class entity-name="survey" table="SURVEY" lazy="true" name="gov.va.med.cds.template.generated.surveyscommon.Survey">
        <id type="java.lang.Long" name="id">
            <column name="SURVEY_ID"/>
            <generator class="sequence" >
				<param name="sequence">survey_seq_id</param>
			</generator>
        </id>

		<property name="surveyTitle" column="TITLE" type="java.lang.String"/>

		<property name="surveyVersion" column="VERSION" type="java.lang.String"/>

		<property name="surveyType" column="TYPE" type="java.lang.String" />

        <!--  one-to-many sets -->
<!-- 
		<!- one-to-many set wrapped in the collection component so Hibernate locates it within XMl Document ->
		<component name="questions" node="questions">
				<set name="questionsSet" table="SURVEY_QUESTION" node="." cascade="all" embed-xml="true">
				<key column="SURVEY_ID" not-null="true" />
				<one-to-many entity-name="question" node="question" embed-xml="true"/>
			</set>
		</component>
		-->
		
		<list name="surveyQuestions" node="surveyQuestion">
			<key column="SURVEY_ID" update="false" />
			<list-index column="QUESTION_NUMBER"  />
			<one-to-many entity-name="SurveyQuestion" />
		</list>
<!-- 
		<list name="questions">
			<key column="SURVEY_ID" not-null="true" />
			<list-index column="QUESTION_NUMBER" />
			<one-to-many class="gov.va.med.cds.cdm.surveys.SurveyQuestion" />
		</list>
 -->
    </class>

</hibernate-mapping>
