<?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.FilterIdWrapper" table="FILTER_NAME" lazy="false" >
        <id type="java.lang.Long" name="id" >
            <column name="FILTER_NAME_ID" />
            <generator class="sequence">
                <param name="sequence">filter_name_seq_id</param>
            </generator>
        </id>

        <property name="filterId" column="FILTER_NAME_IDENTIFIER" type="java.lang.String" />
    </class>
    
    <query name="filter.id">
        <![CDATA[
        from FilterIdWrapper f
        where f.id = :id
        ]]>
    </query>
    
    <query name="filter.name">
        <![CDATA[
        from FilterIdWrapper f
        where f.filterId = :filterName
        and f.id = (select min(f1.id) from FilterIdWrapper f1 where f1.filterId = :filterName )
        ]]>
    </query>

</hibernate-mapping>
