diff --git a/src/main/java/com/loafle/overflow/member/dao/JPAMemberDAO.java b/src/main/java/com/loafle/overflow/member/dao/JPAMemberDAO.java index 182f691..fb8e7db 100644 --- a/src/main/java/com/loafle/overflow/member/dao/JPAMemberDAO.java +++ b/src/main/java/com/loafle/overflow/member/dao/JPAMemberDAO.java @@ -3,11 +3,17 @@ package com.loafle.overflow.member.dao; import com.loafle.overflow.commons.dao.JPABaseDAO; import com.loafle.overflow.member.model.Member; -import java.util.List; - +import javax.persistence.Query; /** * Created by insanity on 17. 5. 25. */ public class JPAMemberDAO extends JPABaseDAO implements MemberDAO{ + public Member findByEmail(Member member) { + + Query query = getEntityManager().createNativeQuery("SELECT m.* FROM MEMBER m WHERE m.email = :email", Member.class); + query.setParameter("email", member.getEmail()); + + return (Member)query.getSingleResult(); + } } diff --git a/src/main/java/com/loafle/overflow/member/dao/MemberDAO.java b/src/main/java/com/loafle/overflow/member/dao/MemberDAO.java index cfd1b7f..5b910fe 100644 --- a/src/main/java/com/loafle/overflow/member/dao/MemberDAO.java +++ b/src/main/java/com/loafle/overflow/member/dao/MemberDAO.java @@ -3,11 +3,9 @@ package com.loafle.overflow.member.dao; import com.loafle.overflow.commons.dao.BaseDAO; import com.loafle.overflow.member.model.Member; -import javax.persistence.Inheritance; -import java.util.List; - /** * Created by insanity on 17. 5. 25. */ public interface MemberDAO extends BaseDAO { + public Member findByEmail(Member member); }