spring boot 다시 질문할게요 User클래스

조회수 81회

User.java package com.example.study.model.entity;

//import com.example.study.model.enumclass.UserStatus; import lombok.*; import lombok.experimental.Accessors; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*; import java.time.LocalDateTime; import java.util.List;

@Data @AllArgsConstructor @NoArgsConstructor @Entity

@Accessors(chain = true) public class User {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String account;

private String email;

private String phoneNumber;


private LocalDateTime createdAt;


private String createdBy;


private LocalDateTime updatedAt;


private String updatedBy;

}

UserRepositoryTest.java

package com.example.study.repository;

import com.example.study.StudyApplicationTests; import com.example.study.model.entity.User; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;

public class UserRepositoryTest extends StudyApplicationTests {

//Dependency Injection(DI)
@Autowired
private UserRepository userRepository;

@Test
public void create(){
    //String sql = insert into user (%s ,%s,%d) value(accout,email,age)

   User user=new User();
   user.setAccount("minit");
   user.setEmail("TestUser01@gmail.com");
   user.setPhoneNumber("010-1111-1111");
   user.setCreatedAt(LocalDateTime.now());
   user.setCreatedBy("admin");



    //User newUser = userRepository.save(user);
    //System.out.println("newUser:"+newUser);


}

public void read(){

}

public void update(){

}

public void delete(){

}

}

에러메세지 /home/nakazaki/IdeaProjects/study/src/test/java/com/example/study/repository/UserRepositoryTest.java:21: error: cannot find symbol user.setAccount("minit"); ^ symbol: method setAccount(String) location: variable user of type User /home/nakazaki/IdeaProjects/study/src/test/java/com/example/study/repository/UserRepositoryTest.java:22: error: cannot find symbol user.setEmail("TestUser01@gmail.com"); ^ symbol: method setEmail(String) location: variable user of type User /home/nakazaki/IdeaProjects/study/src/test/java/com/example/study/repository/UserRepositoryTest.java:23: error: cannot find symbol user.setPhoneNumber("010-1111-1111"); ^ symbol: method setPhoneNumber(String) location: variable user of type User /home/nakazaki/IdeaProjects/study/src/test/java/com/example/study/repository/UserRepositoryTest.java:24: error: cannot find symbol user.setCreatedAt(LocalDateTime.now()); ^ symbol: method setCreatedAt(LocalDateTime) location: variable user of type User /home/nakazaki/IdeaProjects/study/src/test/java/com/example/study/repository/UserRepositoryTest.java:25: error: cannot find symbol user.setCreatedBy("admin"); ^ symbol: method setCreatedBy(String) location: variable user of type User 5 errors FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':compileTestJava'. > Compilation failed; see the compiler error output for details.
  • Try:

이정도이고 위에 create()문 안에있는거 주석처리해도 오류가뜨네요

1 답변

답변을 하려면 로그인이 필요합니다.

Hashcode는 개발자들을 위한 무료 QnA 사이트입니다. 계정을 생성하셔야만 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)

ᕕ( ᐛ )ᕗ
로그인이 필요합니다

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 계정을 생성하셔야만 글을 작성하실 수 있습니다.