@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) @Override public ResponseDTO getResponse(long id) { JpaResponse jpaResponse = jpaSurveyDao.getResponse(id); log.debug(jpaResponse.toString()); return jpaResponse == null ? null : surveyMapper.toResponse(jpaResponse); }
@Transactional @Override public ResponseDTO updateResponse(ResponseDTO response) { JpaResponse existingResponse = jpaSurveyDao.getResponse(response.getId()); if (existingResponse == null) { log.warn("Cannot update response - does not exist", response.toString()); return null; } JpaResponse jpaResponse = surveyMapper.toJpaResponse(response); log.debug("existing response: " + existingResponse.toString()); log.debug("source DTO response: " + response.toString()); log.debug("mapped response: " + jpaResponse.toString()); jpaResponse = jpaSurveyDao.updateResponse(jpaResponse); log.debug("updated response: " + jpaResponse.toString()); return surveyMapper.toResponse(jpaResponse); }