insert into member (age, team_id, username, member_id)values (10, NULL, 'member1', 1);select member0_.member_id as member_i1_0_, member0_.age as age2_0_, member0_.team_id as team_id4_0_, member0_.username as username3_0_from member member0_where member0_.username ='member1';
더티 체킹은 원본과 수정본을 둘 다 메모리에 들고 있어야 하고 체크하는 과정도 필요하기 때문에 비용이 든다.
@SpringBootTest@Transactional@Rollback(value =false)classMemberRepositoryTest { @Testpublicvoidlock() {memberRepository.save(newMember("member1",10));em.flush();em.clear();List<Member> members =memberRepository.findByUsername("member1"); }}
select member0_.member_id as member_i1_0_, member0_.age as age2_0_, member0_.team_id as team_id4_0_, member0_.username as username3_0_from member member0_where member0_.username ='member1'forupdate;