Members.java를 통해 Entity를 설정했고 createQuery를 작성할 땐 아무생각 없이 members라고 적었는데, 이 부분에서 오류가 발생했다. 꼭 query에서 테이블명 쓸 때, 정확한 클래스명 사용할 것
Members.java
package com.market.webservice.domain.members;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import com.market.webservice.domain.BaseTimeEntity;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Entity
public class Members extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(columnDefinition = "TEXT", nullable = false)
private String userID;
private String userPassword;
private String userNickname;
private String userMobile;
@Builder
public Members(String userID, String userPassword, String userNickname, String userMobile) {
this.userID = userID;
this.userPassword = userPassword;
this.userNickname = userNickname;
this.userMobile = userMobile;
}
}
UserDetailServiceImpl.java (수정 후)
List<Members> findMembers = em
.createQuery("select m from Members m where m.userID = :userID",Members.class)
.setParameter("userID", s)
.getResultList();