전체 글

· Spring
@AllArgsConstructor 사용의 문제점 @AllArgsConstructor는 모든 필드를 가진 생성자를 만들어줍니다 @AllArgsConstructor public class BuildMe { private String name; private int age; private String keyword; } ------------------------------------------------------------------------------------- public class BuildMe { private String name; private int age; private String keyword; public BuildMe(final String name, final int age, ..
· Spring
테스트를 짜던 도중 set을 이용해 데이터를 변경시에는 DB에 반영이 안되는데 Service를 이용할 시에는 반영되는 현상을 보고 Transactinal을 붙였더니 뭔가 다 안되길래 해결한 경험을 적습니다! Spring Boot Test에서는 테스트 수행 후에 트랜잭션 커밋 내역을 모두 롤백시킵니다. 어렴풋이 알고는 있었지만 평소에 테스트 할 때에 service난 repository를 주입받아서 사용하면 데이터가 저장되었던 기억과 혼동되어서 정확한 동작원리를 파악하지 못하고 있었습니다. 정확히는 테스트 레벨에 붙어있는 Transactional은 롤백 되지만 주입받아서 사용하는 Service단이나 Spring Data JPA에서 기본으로 제공하는 @Transactinal은 롤백되지 않습니다. 또한, 이 둘..
· Spring
Error creating bean with name 'entityManagerFactory' defined in class path resource Could not determine recommended JdbcType for `com.sbb.question.domain.Question` entityManagerFactory를 초기화 하지 못했다 -> `com.sbb.question.domain.Question` 에 권장되는 jdbcType을 결정할 수 없다 위와 같은 에러가 발생하는 이유로 여러가지 이유가 있는 존재합니다.(Entity생성 오류로 추정) 보통 연관관계 설정을 잘못해서 발생하는 것 같은데 저는 @GeneratedValue를 auto로 놔둬서 오류가 놨던것 같습니다. -> mariaDB..
Seung__Yong
기록