construct method added
This commit is contained in:
parent
80452e4ff3
commit
5d8228b09a
|
@ -3,6 +3,7 @@ package com.loafle.overflow.module.member.dao;
|
|||
import com.loafle.overflow.module.member.model.Member;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +11,6 @@ import org.springframework.stereotype.Repository;
|
|||
*/
|
||||
@Repository
|
||||
public interface MemberDAO extends JpaRepository<Member, Long> {
|
||||
// @Query("SELECT m FROM MEMBER m WHERE m.email = :email")
|
||||
// Member findByEmail(Member member);
|
||||
@Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
||||
Member findByEmail(@Param("m2") Member member);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,26 @@ public class MemberDAOTest {
|
|||
m.setPwSalt("salktttt");
|
||||
m.setPhone("000-000-0000");
|
||||
m.setEmail("insanity1@loafle.com");
|
||||
m.setStatus(new MetaMemberStatus());
|
||||
m.setStatus(new MetaMemberStatus((short)1));
|
||||
repo.save(m);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestFindByEmail() {
|
||||
Member m = new Member();
|
||||
|
||||
m.setEmail("insanity1@loafle.com");
|
||||
|
||||
Member mm = this.repo.findByEmail(m);
|
||||
|
||||
System.out.println(mm.getCompanyName());
|
||||
}
|
||||
@Test
|
||||
public void updateMember() {
|
||||
Member m = this.repo.findOne((long)1);
|
||||
|
||||
m.setPw("123123123");
|
||||
m.setStatus(new MetaMemberStatus((short)2));
|
||||
this.repo.save(m);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user