<?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="censusMasterIngest" table="CENSUS_MASTER_INGEST" lazy="false" name="gov.va.med.cds.template.generated.surveys.CensusMasterIngest" >
        <id type="java.lang.Long" name="id">
            <column name="CENSUS_MASTER_ID"/>
            <generator class="sequence" >
				<param name="sequence">census_master_ingest_seq_id</param>
			</generator>
        </id>
        
        <property name="reportStartDatetime" column="REPORT_START_DT" type="java.util.Date"/>		
		<property name="censusExpectedCount" column="SEGMENTS_EXPECTED_CNT" type="java.lang.Integer" />
		<property name="censusReceivedCount" column="SEGMENTS_RECEIVED_CNT" type="java.lang.Integer" />
		
		<property name="ingestStatus" column="INGEST_STATUS" type="java.lang.String" />
		<property name="vendorName" column="VENDOR_NAME" type="java.lang.String" />
		<property name="vendorFacility" column="VENDOR_FACILITY" type="java.lang.String" />
			
		<property name="segmentDatetime" column="SEGMENT_DATETIME" type="java.lang.String"/>
	
	</class>
	
	<class name="gov.va.med.cds.persistence.hibernate.CensusIDs">
        <id name="censusMasterID" type="java.lang.Long" />
        <property name="censusSegmentID" type="java.lang.Long" />
        <property name="errorMessage" type="java.lang.String" />
        <property name="ackStatus" column="java.lang.String" />
	</class>
	
	<sql-query name="census_master_record_mgt.census_master_records" callable="true" >
		<return class="gov.va.med.cds.persistence.hibernate.CensusIDs">
	   		<return-property name="censusMasterID" column="censusMasterID" />
			<return-property name="censusSegmentID" column="censusSegmentID" />
			<return-property name="errorMessage" column="STATUS_MSG" />
			<return-property name="ackStatus" column="ackStatus" />
	 	</return>
		{ call census_master_record_mgt.census_master_records( ?, :reportStartDate, :vendorName, :vendorFacility, :segmentDatetime, :censusExpectedCount, :currentSegment,
											:senderAddress, :reportEndDt, :requestId, :sendingApplication, :stationNo, :sendingFacility, :receivingApplication, :receivingFacility ) }
	</sql-query>
	
	<sql-query name="census_master_record_mgt.census_segment_complete" callable="true" >
		{ call census_master_record_mgt.census_segment_complete( ?, :censusMasterID, :censusSegmentID ) }
	</sql-query>
     
</hibernate-mapping>
