<?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="VistaUserRead1" table="VISTA_HDSI.NEW_PERSON_200" lazy="false" name="gov.va.med.cds.template.generated.vistauser.VistaUser">
        <id name="idV" type="big_decimal">
			<column name="ROWID" />
			<generator class="assigned" />
		</id>
		
		<component name="identifier" class="gov.va.med.cds.template.generated.basedatatypes.HL72PersonIdentifier">
				<property name="identity" type="gov.va.med.cds.persistence.hibernate.common.VistaIdentityUserType" insert="false" update="false">
					<column name="ROWID"/>
				</property>
				<property name="assigningFacility" formula="VISTA_HDSI.HDSREPSQLUtil1_StationNumber()" type="java.lang.String" />
				<property name="assigningAuthority" formula="'USVHA'" type="java.lang.String" />
		</component>
	
        <property name="displayName" column="NAME" type="java.lang.String" />
        
        <property name="nameComponents" formula="VISTA_HDSI.HDSREPSQLUtil1_MiscNameNE(ROWID)" type="gov.va.med.cds.persistence.hibernate.common.VistaPersonNameUserType"/>
        
        <property name="nickName" column="NICK_NAME" type="java.lang.String" />

		<component name="address" class="gov.va.med.cds.template.generated.basedatatypes.UsMailingAddress">
            <property name="line1" column="STREET_ADDRESS_1" type="java.lang.String"/>
            <property name="line2" column="STREET_ADDRESS_2" type="java.lang.String"/>
            <property name="line3" column="STREET_ADDRESS_3" type="java.lang.String"/>
            <property name="city" column="CITY" type="java.lang.String"/>
            <property name="state" column="STATEX" type="java.lang.String"/>
            <property name="postalCode" column="ZIP_CODE" type="java.lang.String"/>
		</component>
   
		<property name="sex" column="SEX" type="java.lang.String" />
		
		<property name="terminationDate" formula="STRING(TERMINATION_DATE,'^',(VISTA_HDSI.HDSREPSQLUtil1_StationNumber()))" type="gov.va.med.cds.persistence.hibernate.common.VistaPointInTimeUserType" insert="false" update="false" />
		<property name="disUser" column="DISUSER" type="java.lang.String" />
    
	</class>
	
    <!-- Queries -->
  	
	<query name="VistaUsersRead1.VistaUser.vistaUsers.authorLastName.authorFirstName">
		<![CDATA[
		from VistaUserRead1 vu
        where upper(vu.displayName) like upper(:authorLastName||','||:authorFirstName||'%')
        and ( vu.terminationDate is null)  and ( (vu.disUser is null) or (vu.disUser <> 'YES') )
      ]]>
	</query>
	<query name="VistaUsersRead1.VistaUser.vistaUsers.authorFirstName.authorLastName">
		<![CDATA[
		from VistaUserRead1 vu
        where upper(vu.displayName) like upper(:authorLastName||','||:authorFirstName||'%')
        and ( vu.terminationDate is null)  and ( (vu.disUser is null) or (vu.disUser <> 'YES') )
      ]]>
	</query>

	<query name="VistaUsersRead1.VistaUser.vistaUsers.authorLastName.authorFirstName.authorMiddleName">
		<![CDATA[
		from VistaUserRead1 vu
        where upper(vu.displayName) like upper(:authorLastName||','||:authorFirstName||' '||:authorMiddleName||'%')
        and ( vu.terminationDate is null)  and ( (vu.disUser is null) or (vu.disUser <> 'YES') )
      ]]>
	</query>
	<query name="VistaUsersRead1.VistaUser.vistaUsers.authorFirstName.authorLastName.authorMiddleName">
		<![CDATA[
		from VistaUserRead1 vu
        where upper(vu.displayName) like upper(:authorLastName||','||:authorFirstName||' '||:authorMiddleName||'%')
        and ( vu.terminationDate is null)  and ( (vu.disUser is null) or (vu.disUser <> 'YES') )
      ]]>
	</query>
	<query name="VistaUsersRead1.VistaUser.vistaUsers.authorFirstName.authorMiddleName.authorLastName">
		<![CDATA[
		from VistaUserRead1 vu
        where upper(vu.displayName) like upper(:authorLastName||','||:authorFirstName||' '||:authorMiddleName||'%')
        and ( vu.terminationDate is null)  and ( (vu.disUser is null) or (vu.disUser <> 'YES') )
      ]]>
	</query>
		
</hibernate-mapping>
