<?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="findAllLoanEmployeeDetailByIdLoan">
        <![CDATA[
            SELECT 
                p
            FROM LoanEmployeeDetailAllDataView p
                WHERE 
                    id_loan = :idLoanEmployee AND loan_employee_detail_status = 'ENEBLED'
        ]]>
    </query>
    
    <query name="findLoanDetailToUpdate">
        <![CDATA[
            SELECT 
                p
               FROM LoanEmployeeDetails p
          
            WHERE loanEmployeeDetailStatus = 'ENEBLED' and payroll = 'ENEBLED' and id_user = :idUser and DATE(created_On) = DATE(:createdOn)
        ]]>
    </query>
    
    <query name="updateLoanEmployeeDetailByStatus">
        <![CDATA[
            UPDATE LoanEmployeeDetails
            SET 
               loanEmployeeDetailStatus = 'DISABLED'
            WHERE payroll = 'ENEBLED' and id_user = :idUser and DATE(created_On) = DATE(:createdOn)
        ]]>
    </query>
</hibernate-mapping>
