<?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="all">
    <class entity-name="nonVaMedicationEvent" table="NONVAMED_V" lazy="false" node="nonVaMedicationEvent" >
        <id name="id" type="java.lang.Long">
            <column name="NONVAMED_ID" />
            <generator class="sequence" >
				<param name="sequence">NONVAMED_ID_SEQ_ID</param>
			</generator>
        </id>
        
        <property name="requestId" column="REQUEST_ID" type="java.lang.String" insert="true" update="false" node="requestId" />
                  
        <component name="pharmacyPatient" node="pharmacyPatient">
            <component name="identifier" node="identifier">
                <property name="identity" column="PATIENT_IDENTITY" type="java.lang.String" not-null="true" node="identity"/>
                <property name="assigningFacility" column="PATIENT_ASSIGNING_FACILITY" type="java.lang.String" not-null="true" node="assigningFacility"/>
                <property name="assigningAuthority" column="PATIENT_ASSIGNING_AUTHORITY" type="java.lang.String" node="assigningAuthority"/>
            </component>
            <component name="name" node="name">
				<property name="prefix" column="PATIENT_NAME_PREFIX" type="java.lang.String" node="prefix"/>
				<property name="given" column="PATIENT_NAME_GIVEN" type="java.lang.String" node="given"/>
				<property name="middle" column="PATIENT_NAME_MIDDLE" type="java.lang.String" node="middle"/>
				<property name="family" column="PATIENT_NAME_FAMILY" type="java.lang.String" node="family"/>
				<property name="suffix" column="PATIENT_NAME_SUFFIX" type="java.lang.String" node="suffix"/>
				<property name="title" column="PATIENT_NAME_TITLE" type="java.lang.String" node="title"/>
			</component>
        </component>
           
        <!-- ADD Patient Name into table will use patientLite declared above-->
        <!-- property name="name" column="PatientNE" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType" insert="false" update="false" node="pharmacyPatient//name"  /-->
     
        <component name="dosage" node="dosage">
  		    <property name="value" column="DOSAGE_QTY" type="java.lang.String" node="value"/>
        </component>

		 <component name="schedule" node="schedule">
		    <property name="displayText" column="SCHEDULE_FREQUENCY" type="java.lang.String" node="displayText" />
		 </component>
		 
		 <component name="status" node="status">
		    <property name="displayText" column="STATUS" type="java.lang.String" node="displayText" />
		 </component>
	
		<component name="medication" node="medication">
			<component name="medicationCode" node="medicationCode">
				<property name="displayText" column="MEDICATION_NAME" type="java.lang.String" node="displayText"/>
				<property name="alternateDisplayText" column="GENERIC_MEDICATION_NAME" type="java.lang.String" node="alternateDisplayText"/>
			</component>
		</component>
	
		<component name="pharmacyOrderableItem" node="pharmacyOrderableItem">
			<component name="dosageFormCode" node="dosageFormCode">
				<property name="displayText" column="MEDICATION_FORM" type="java.lang.String" node="displayText"/>
			</component>
		</component>

    </class>
     
</hibernate-mapping>
