<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT m.table_name,
                       m.table_pk_value,
                       m.record_id,
                       fa.attachment_id,
                       fa.file_name,
                       fa.file_path
                  FROM fnd_atm_attachment       fa,
                       fnd_atm_attachment_multi m,
                       CUX_CONTRACT_PRINT       t,
                       con_contract_rent_temp   tp
                 WHERE m.attachment_id = fa.attachment_id
                   AND fa.source_type_code = 'fnd_atm_attachment_multi'
                   AND fa.source_pk_value = m.record_id
                   AND m.table_name = 'CUX_CONTRACT_PRINT'
                   AND m.table_pk_value = t.print_id
                   and t.print_id = tp.print_id
                   and tp.session_id = ${/session/@session_id}
            ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="table_pk_value"/>
                <bm:parameter name="table_name"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME" required="true"/>
        <bm:field name="table_pk_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_PK_VALUE" required="true"/>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" required="true"/>
        <bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID" required="true"/>
        <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
        <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
    </bm:fields>
</bm:model>
