From 8757f203c18b3f480886b5d3f1430f8534f8b14e Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 26 May 2017 19:00:36 +0900 Subject: [PATCH] 1.0.0-SNAPSHOT --- .../com/loafle/overflow/member/dao/JPAMemberDAO.java | 10 ++++++++-- .../java/com/loafle/overflow/member/dao/MemberDAO.java | 4 +--- 2 files changed, 9 insertions(+), 5 deletions(-) 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); }