<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm"
          xmlns:f="leaf.database.features" alias="fam" needAccessControl="false" baseTable="fnd_atm_attachment_multi">
    <bm:fields>
        <bm:field databaseType="NUMBER" datatype="java.lang.Long" name="record_id"/>
        <bm:field databaseType="VARCHAR" datatype="java.lang.String" name="table_name"/>
        <bm:field databaseType="VARCHAR" datatype="java.lang.String" name="table_pk_value"/>
        <bm:field databaseType="NUMBER" datatype="java.lang.Long" name="attachment_id"/>
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="record_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="record_id" queryOperator="="/>
        <bm:query-field field="table_name" queryOperator="=" required="true"/>
        <bm:query-field field="table_pk_value" queryOperator="=" required="true"/>
    </bm:query-fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:ref-fields/>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                select * from(select *
                from fnd_atm_attachment_multi fam
                where table_name = ${@table_name} and table_pk_value = ${@table_pk_value}
                order by creation_date desc) where rownum = 1
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
