package com.itsol.quantrivanphong.access.register.repository;



import com.itsol.quantrivanphong.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;


public interface RegisterRepository extends JpaRepository<Employee, Integer> {
    Employee findByUsername(String username);
    Employee findByEmailAddress(String emailAddress);


    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(value = "UPDATE employee e SET e.password = ?1, e.status = ?2 where e.id = ?3", nativeQuery = true)
    void insertPassword(String password, boolean status, int id);
}
