소개
게시글
질문&답변
2022.04.23
jsp 프로젝트 진행중에 save.jsp로 넘어갈시 계속해서 500에러가 뜹니다...
네 아직 해결을 못했네요,,, 구글 드라이브에 올리겠습니다. 감사합니다. https://drive.google.com/file/d/1vuMhxyiDnk4Gi5yHALJEtGOaa73Or8bs/view?usp=sharing
- 0
- 3
- 822
질문&답변
2022.04.23
jsp 프로젝트 진행중에 save.jsp로 넘어갈시 계속해서 500에러가 뜹니다...
네 에러메세지는 아래와 같습니다! (사진) (사진) (사진) (사진) (사진) (사진)
- 0
- 3
- 822
질문&답변
2022.04.16
MemberRepositoryTest를 돌리는 과정에서 아래와 같이 에러가 나타납니다.
네 감사합니다. 위와 같이 findUsername으로 작성을 하고 돌렸는데 위와 비슷한 에러를 만나서 해결을 계속하고 있지만 찾지못하였습니다..... Error creating bean with name 'memberRepository' defined in study.datajpa.repository.MemberRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.List study.datajpa.repository.MemberRepository.findByUsernameAndAgeGreaterThen(java.lang.String,int)! Reason: Failed to create query for method public abstract java.util.List study.datajpa.repository.MemberRepository.findByUsernameAndAgeGreaterThen(java.lang.String,int)! No property 'greaterThen' found for type 'int'! Traversed path: Member.age.; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List study.datajpa.repository.MemberRepository.findByUsernameAndAgeGreaterThen(java.lang.String,int)! No property 'greaterThen' found for type 'int'! Traversed path: Member.age. Member Class입니다. package study.datajpa.entity;import lombok.*;import javax.persistence.*;import static javax.persistence.FetchType.*;@Entity@Getter@Setter@NoArgsConstructor(access = AccessLevel.PROTECTED)@ToString(of = {"id", "username", "age"})public class Member { @Id @GeneratedValue @Column(name = "member_id") private Long id; private String username; private int age; @ManyToOne(fetch = LAZY) @JoinColumn(name = "tema_id") private Team team; public Member(String username) { this.username = username; } public Member(String username, int age) { this.username = username; this.age = age; } public Member(String username, int age, Team team) { this.username = username; this.age = age; if (team != null) { changeTeam(team); } } public void changeTeam(Team team) { this.team = team; team.getMembers().add(this); }} MemberRepository 입니다. package study.datajpa.repository;import org.springframework.data.jpa.repository.JpaRepository;import study.datajpa.entity.Member;import java.util.List;public interface MemberRepository extends JpaRepositoryMember, Long> { ListMember> findByUsernameAndAgeGreaterThen(String username, int age); ListMember> findHelloBy();} MemberRepositoryTest입니다. package study.datajpa.repository;import org.assertj.core.api.Assertions;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.test.annotation.Rollback;import org.springframework.transaction.annotation.Transactional;import study.datajpa.entity.Member;import java.util.List;import static org.assertj.core.api.Assertions.*;import static org.junit.jupiter.api.Assertions.*;@SpringBootTest@Transactional@Rollback(false)class MemberRepositoryTest { @Autowired MemberRepository memberRepository; @Test public void testMember() { System.out.println("memberRepository = " + memberRepository.getClass()); Member member = new Member("memberA"); Member savedMember = memberRepository.save(member); Member findMember = memberRepository.findById(savedMember.getId()).get(); assertThat(findMember.getId()).isEqualTo(member.getId()); assertThat(findMember.getUsername()).isEqualTo(member.getUsername()); assertThat(findMember).isEqualTo(member); } @Test public void basicCRUD() { Member member1 = new Member("member1"); Member member2 = new Member("member2"); memberRepository.save(member1); memberRepository.save(member2); // 단건 조회 검증 Member findMember1 = memberRepository.findById(member1.getId()).get(); Member findMember2 = memberRepository.findById(member2.getId()).get(); assertThat(findMember1).isEqualTo(member1); assertThat(findMember2).isEqualTo(member2); findMember1.setUsername("member!!!!!!!"); // 리스트 조회 검증 ListMember> all = memberRepository.findAll(); assertThat(all.size()).isEqualTo(2); // 카운트 검증 long count = memberRepository.count(); assertThat(count).isEqualTo(2); // 삭제 검증 memberRepository.delete(member1); memberRepository.delete(member2); long deleteCount = memberRepository.count(); assertThat(deleteCount).isEqualTo(0); } @Test public void findByUsernameAndAgeGreaterThen() { Member m1 = new Member("AAA", 10); Member m2 = new Member("AAA", 20); memberRepository.save(m1); memberRepository.save(m2); ListMember> result = memberRepository.findByUsernameAndAgeGreaterThen("AAA", 15); assertThat(result.get(0).getUsername()).isEqualTo("AAA"); assertThat(result.get(0).getAge()).isEqualTo(20); assertThat(result.size()).isEqualTo(1); } @Test public void findHelloBy() { ListMember> helloBy = memberRepository.findHelloBy(); }}
- 0
- 2
- 1.7K
질문&답변
2022.04.14
주문내역을 들어갈 때 에러가 났습니다.
ㅠㅠ 늦은시간에 답변 감사합니다!!
- 0
- 2
- 905
질문&답변
2022.04.11
안녕하세요 6분정도에서 무한루프관련이 안뜨고 에러가 떠서 질문드립니다.
강사님 해결하였습니다. 감사합니다. member에 아래와 같이 @embedded부분에 @jsonIgnore를 넣으니 해결되었습니다. (사진)
- 0
- 1
- 626