OSIV false ์ผ๋ ์์์ฑ ๊ด๋ จํด์ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
๋ก๊ทธ๋ก ์ฟผ๋ฆฌ๋ฅผ ์ฐ์ด๋ด๋ save ํธ์ถํ๋ ๋ฉ์๋๋ select ๋ฐ์ ์๋ ๋ผ๊ฐ๊ณ ์๋๋ผ๊ตฌ์.. ๋ญ๋ฅผ ๋์น๊ณ ์๋๊ฑด๊ฐ์? import org.springframework.transaction.annotation.Transactional; @Service @Transactional(readOnly = true) @RequiredArgsConstructor public class service { ... @Transactional public Entity insert(String id) { DTO dto = new DTO(); dto.setId(id); Entity entity = repository.save(Entity.create(dto)); log.debug("entity {}", entity); //์ฌ๊ธฐ์๋ ์ํฐํฐ๊ฐ ์ ์์ ์ผ๋ก ์ฐํ๋๋ค. return entity; // ๊ทธ๋ ๋ค๋ฉด return์ด ๋๊ณ ๋๋ค์ ํธ๋์ญ์
์ด ์ข
๋ฃ๋๋ insert๋ฌธ์ด ๋๊ฐ์ผํ๋๊ฑฐ ์๋๊ฐ์?.. } } save๋ง๊ณ saveAndFlush๋ฅผ ์ฌ์ฉํ๋ฉด.. no transaction is in progress ๋ผ๊ณ ์ค๋ฅ๊ฐ๋์ค๋๋ฐ.. ์.. @Transactional ์ ๋ฉ์๋์์ ์ด๋ฐ์๋ฌ๊ฐ ์๊ธฐ๋์ง..