<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
    default-lazy="false"
    auto-import="true"
    default-access="property"
    default-cascade="all"
    package="gov.va.med.esr.common.model.ee">

	<class
        name="MonetaryBenefitAward"
        table="MONETARY_BENEFIT_H">
		
		<id
				    name="identifier"
					type="big_decimal"
			        column="MONETARY_BENEFIT_ID">
					
					<generator class="gov.va.med.fw.persistent.hibernate.BigSequenceGenerator">
						<param name="sequence">transaction_s</param>
			        </generator>			
		    	</id>
				
				<version 
					name="version" 
					type="java.lang.Integer" 
					column="RECORD_MODIFIED_COUNT">
				</version>
				
				<many-to-one
		            name="person"
		            class="gov.va.med.esr.common.model.person.Person"
		            cascade="none"
		            insert="true"
		            update="false">
					<column name="PERSON_ID" />
		        </many-to-one>
				
		<set
            name="internalMonetaryBenefits"
            lazy="true"
            inverse="true"
            cascade="all-delete-orphan"
            order-by="RECORD_MODIFIED_DATE desc, MONETARY_BENEFIT_DETAIL_H_ID desc">
            <key column="MONETARY_BENEFIT_ID"/>
            <one-to-many class="gov.va.med.esr.common.model.ee.MonetaryBenefit"/>		 
  			<filter name="asOfDate"></filter>
			<filter name="priorToDate"></filter>
        </set>
				
		<property
            name="checkAmount"
            type="big_decimal">
            <column name="MONETARY_BENEFIT_AWARD_AMOUNT" />
        </property>
		
		<property name="createdOn" column="RECORD_CREATED_DATE" type="timestamp" not-null="true" update="false"/>
		<property name="modifiedOn" column="RECORD_MODIFIED_DATE" type="timestamp" not-null="true"/>
		<property name="createdBy" column="RECORD_CREATED_BY" update="false" type="gov.va.med.fw.persistent.hibernate.AuditUserType"/> 
		<property name="modifiedBy" column="RECORD_MODIFIED_BY" type="gov.va.med.fw.persistent.hibernate.AuditUserType"/>
 		<property name="transactionType" column="TRANSACTION_TYPE_CODE" type="gov.va.med.fw.persistent.hibernate.TransactionUserType"/>
 		<property name="historyId" column="MONETARY_BENEFIT_H_ID" type="big_decimal" insert="false" update="false"/>
 		
 		<filter name="asOfDate"></filter>
		<filter name="priorToDate"></filter>
    </class>
</hibernate-mapping>
