소개
게시글
질문&답변
2022.06.04
리덕스 데브툴즈에 액션기록이 안됩니다. ㅠㅠ
네 감사합니다. 찬찬히 다시 살펴보겠습니다.~
- 0
- 2
- 288
질문&답변
2020.08.01
엔티티에 저장이 안되는 문제에 대한 문의
감사합니다.~
- 0
- 7
- 307
질문&답변
2020.08.01
엔티티에 저장이 안되는 문제에 대한 문의
Optional car = carRepository .findById(s.getId()) ; 아.. 저건 필요없는건데, 저거 없이 했을때 안돼서 이렇게 저렇게 시도해보는 중에 들어간 부분입니다. 원래소스는 아래와 같습니다. campName으로 조회한 Camp도 잘 가져옵니다. @Service @Transactional @RequiredArgsConstructor public class CarService { private final CarRepository carRepository ; private final CampRepository campRepository ; @PostConstruct public void initCarData () throws IOException { if ( carRepository .count() > 0 ) { carRepository .findAll().stream().forEach(s -> { String campName = s.getCampEngName(); Camp camp = campRepository .findByEngName( campName ); if ( camp != null ) { addNote(s, camp ); } }); } } public void addNote ( Car car, Camp camp) { System . out .println( ">>>car = " + "" + car.getCarNumber() + ", camp = " + camp + ", campId = " + camp.getId()); car.setNote(camp.getKorName()); } } ------------------------------- 로그찍어보면 아래와같이 car 갯수만큼 잘 찍힙니다. >>>car = 81조4766, camp = 광주2(GWJ2)/광주(Gwangju), campId = 45 >>>car = 83보8744, camp = 인천5(ICH5)/인천(Incheon), campId = 5 --------------------------------- 근데, 컨트롤러에서 addNote 호출하면 정상적으로 저장이 됩니다.
- 0
- 7
- 307
질문&답변
2020.07.31
엔티티에 저장이 안되는 문제에 대한 문의
답변 감사합니다. 해당 코드는 서비스 부분에 위치하고 있습니다. 서비스 전체코드는 아래와 같습니다. 클래스 상단에 @transaction 도 기재했고요. 이렇게 해도 안돼서 문의 드렸습니다. @Service @Transactional @RequiredArgsConstructor public class CarService { private final CarRepository carRepository ; private final CampRepository campRepository ; @PostConstruct public void initCarData () { if ( carRepository .count() > 0 ) { carRepository .findAll().stream().forEach(s -> { String campName = s.getCampEngName() ; Optional car = carRepository .findById(s.getId()) ; Camp camp = campRepository .findByEngName(campName) ; if (camp != null ) { car.ifPresent(m -> addNote(m , camp )) ; } }) ; } } }
- 0
- 7
- 307
질문&답변
2020.07.20
@PathVariable 바인딩 변경 후 오류 문의
감사합니다. ~
- 0
- 4
- 709