<?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="Activation"
        table="ACTIVATION_H">

        <id
            name="identifier"
            type="big_decimal"
            column="ACTIVATION_ID">
            <generator class="gov.va.med.fw.persistent.hibernate.BigSequenceGenerator">
                <param name="sequence">transaction_s</param>
            </generator>
        </id>

        <version
            name="version"
            type="integer"
            column="RECORD_MODIFIED_COUNT"/>

        <property
            name="createdOn"
            type="timestamp"
            not-null="true"
            update="false"
            column="RECORD_CREATED_DATE"/>

        <property
            name="modifiedOn"
            type="timestamp"
            not-null="true"
            column="RECORD_MODIFIED_DATE"/>

        <property
            name="createdBy"
            type="gov.va.med.fw.persistent.hibernate.AuditUserType"
            update="false"
            column="RECORD_CREATED_BY"/>

        <property
            name="modifiedBy"
            type="gov.va.med.fw.persistent.hibernate.AuditUserType"
            column="RECORD_MODIFIED_BY"/>

        <property
            name="activationBeginDate"
            type="date">
            <column name="ACTIVATION_BEGIN_DATE" />
        </property>

        <property
            name="activationEndDate"
            type="date">
            <column name="ACTIVATION_END_DATE" />
        </property>

        <many-to-one
            name="specialOperation"
            class="gov.va.med.esr.common.model.lookup.SpecialOperation"
            outer-join="false"
            cascade="none">
            <column name="STD_SPECIALOPERATION_ID"/>
        </many-to-one>
        
        <many-to-one
            name="namedContingency"
            class="gov.va.med.esr.common.model.lookup.NamedContingency"
            outer-join="false"
            cascade="none">
            <column name="STD_NAMEDCONTINGENCY_ID"/>
        </many-to-one>
        
        <many-to-one
            name="terminationReason"
            class="gov.va.med.esr.common.model.lookup.TerminationReason"
            outer-join="false"
            cascade="none">
            <column name="STD_TERMINATIONREASON_ID"/>
        </many-to-one>
        
        <many-to-one
            name="dataSource"
            class="gov.va.med.esr.common.model.lookup.MHDataSource"
            outer-join="false"
            cascade="none">
            <column name="STD_MHDATASOURCE_ID"/>
        </many-to-one>

        <many-to-one
            name="person"
            class="gov.va.med.esr.common.model.person.Person"
            cascade="none"
            not-null="true"
            update="false"
            column="PERSON_ID">
        </many-to-one>

       <set
            name="internalDeployments"
            lazy="false"
            inverse="true"
            cascade="all-delete-orphan">
            <key column="ACTIVATION_ID"/>
            <one-to-many class="gov.va.med.esr.common.model.ee.Deployment"/>
        </set>
		<property name="transactionType" column="TRANSACTION_TYPE_CODE" type="gov.va.med.fw.persistent.hibernate.TransactionUserType"/>
 		<property name="historyId" column="ACTIVATION_H_ID" type="big_decimal" insert="false" update="false"/>
		
	 	<filter name="asOfDate"></filter>
        <filter name="priorToDate"></filter>           
    </class>
</hibernate-mapping>
