<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"https://hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    
    <query name="findLoanRenovationByNewLoanId">
        <![CDATA[
            SELECT 
                lbr
            FROM
                LoanByRenovation lbr
            WHERE
                lbr.loanNew = :loanNew
        ]]>
    </query>
    
    <query name="updateLoanRenovation">
        <![CDATA[
            UPDATE 
                LoanByRenovation
            SET
                loanRenovationStatus = :loanRenovationStatus,
                comments = :comments,
                lastUpdatedBy = :lastUpdatedBy,
                lastUpdatedOn = :lastUpdatedOn
            WHERE
                id = :id AND
                loanRenovationStatus = 'PENDING'
        ]]>
    </query>
    
    <query name="updateLoanRenovationWeb">
        <![CDATA[
            UPDATE 
                LoanByRenovation
            SET
                loanRenovationStatus = :loanRenovationStatus,
                comments = :comments,
                lastUpdatedBy = :lastUpdatedBy,
                lastUpdatedOn = :lastUpdatedOn
            WHERE
                loanNew = :loanNew AND
                loanRenovationStatus = 'PENDING'
        ]]>
    </query>
    
</hibernate-mapping>
