Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@RequestBody로 받은 객체 필드 계속 null #27

Open
kyupid opened this issue Dec 24, 2021 · 2 comments
Open

@RequestBody로 받은 객체 필드 계속 null #27

kyupid opened this issue Dec 24, 2021 · 2 comments

Comments

@kyupid
Copy link
Owner

kyupid commented Dec 24, 2021

Employee...이것도 엔티티라고 불러줘야ㅕ하는건진 모르겠는데 일단 모르겠으니까 엔티티라하고

엔티티에 getter가 없으니 null,,값을 못받아옴

내 추측으론 이건 마이바티스냐 뭐 JPA냐 상관없이 스프링에서 HttpMessageConverter가

RequestBody로 받는 객체에 getter 가 있어야 정상적으로 값을 받는 것 같음

@kyupid kyupid self-assigned this Dec 24, 2021
@kyupid
Copy link
Owner Author

kyupid commented Dec 24, 2021

마이바티스는 그니까 SQL Mapper니까 이게 디펜던시에 넣으면 작동하는 곳이 딱

xxxMapper 클래스에서 @Mapper 어노테이션을 준 곳에서

    @Insert("insert into employee(name) values( #{employee.name} )")
    int insert(@Param("employee") Employee employee);

이런식으로 마이바티스에서 요구하는 규칙을 따랐을때 디비와 커넥할때 작동하는거

@kyupid kyupid added the 문제 label Dec 24, 2021
@kyupid
Copy link
Owner Author

kyupid commented Dec 24, 2021

롬복에서 엔티티에 @Data 붙여도 됨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant