<?xml version="1.0"?>
<!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" default-cascade="save-update">
	<class name="gov.va.med.cds.audit.ClientMappingPathways" table="CLIENT_MAPPING" lazy="false" >
        <id name="clientMappingId" type="java.lang.Long" >
            <column name="client_Mapping_Id"/>
            <generator class="sequence" >
				<param name="sequence">client_mapping_SEQ_ID</param>
			</generator>
        </id>

        <property name="name" column="CLIENT_NAME" />
	    <property name="shortName" column="CLIENT_SHORT_NAME"/>
        <property name="domainEntryPoints" column="DOMAIN_ENTRY_POINTS"/>
        <property name="domains" column="DOMAINS"/>
       
		<many-to-one name="filterIdWrapper" class="gov.va.med.cds.audit.FilterIdWrapper"
			column="filter_name_Id" unique="true" />
			
		<many-to-one name="templateIdWrapper" class="gov.va.med.cds.audit.TemplateIdWrapper" 
			column="template_name_Id" unique="true"/>
	</class>

    <query name="pathways.clientmapping.filter.template">
        <![CDATA[
        from ClientMappingPathways cm
        left join fetch cm.filterIdWrapper f
        left join fetch cm.templateIdWrapper t
        where t.id = :templateId and f.id = :filterId and lower(cm.name) = lower(:clientName)
        ]]>
    </query>


</hibernate-mapping>
