SpringData Jpa 의 @ Query 와 select 에 대한 이해

947 단어 Java
package com.xhz.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import com.xhz.entity.User;

/**
 *   Repository  
 * 
 * @author xhz
 *
 */
public interface UserRepository extends JpaRepository, JpaSpecificationExecutor {

/**
*               
* SELECT * FROM XHZ_USER U WHERE U.USER_NAME=?1 AND U.PASSWORD=?2
*          ,   list   
* @param userName
* @param password
* @return
*/
@Query(value = "SELECT * FROM XHZ_USER U WHERE U.USER_NAME=?1 AND U.PASSWORD=?2")
public User selectUserInfoByUserNameAndPassword(String userName, String password);

@Query(value = "SELECT * FROM XHZ_USER WHERE USER_NAME=?1 AND PASSWORD=?2")
public User selectUserInfoByUserNameAndPassword(String userName, String password);
}

좋은 웹페이지 즐겨찾기