<?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="all">
    <class name="gov.va.med.cds.audit.TemplateIdWrapper" table="TEMPLATE_NAME" lazy="false">
        <id type="java.lang.Long" name="id" >
            <column name="TEMPLATE_NAME_ID" />
 			<generator class="sequence">
				<param name="sequence">template_name_seq_id</param>
			</generator>
        </id>

		<property name="templateId" column="TEMPLATE_NAME_IDENTIFIER" type="java.lang.String" />
	</class>
	
	<query name="template.id">
        <![CDATA[
        from TemplateIdWrapper t
        where t.id = :id
        ]]>
    </query>
	
	<query name="template.name">
        <![CDATA[
        from TemplateIdWrapper t
        where t.templateId = :templateName
        and t.id = (select min(t1.id) from TemplateIdWrapper t1 where t1.templateId = :templateName )
        ]]>
    </query>


</hibernate-mapping>
