Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.cami.persistence.dao; import com.cami.persistence.model.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; /** * * @author Brice GUEMKAM <briceguemkam@gmail.com> */ public interface IUserDao extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> { @Query("SELECT u FROM User u WHERE u.username= :username AND u.password= :password") public User findByUsernameAndPassword(@Param("username") String username, @Param("password") String password); @Query("SELECT u FROM User u WHERE u.username= :username") public User findByUsername(@Param("username") String username); }