Spring data JPA transaction simple Isolation(READ_UNCOMMITTED,READ_COMMITTED,REPEATABLE_READ) example 1.
I create a test class and write three method. First method will save a new user to database.I started the first method in debug mode and add a debug point in package org.springframework.data.jpa.repository.support.SimpleJPARepository. The SimpleJPARepository is the default implementation of Spring Data JPA repository interfaces. Breakpoint in save method . this line ( this .em.persist(entity) ). provides persist of user object public class SimpleJpaRepository<T, ID extends Serializable> implements JpaRepository<T, ID>, JpaSpecificationExecutor<T> { ... @Transactional public <S extends T> S save(S entity) { if ( this .entityInformation.isNew(entity)) { this .em.persist(entity); //AbstractEntityManagerImpl persist method return entity;// BreakPoint HERE } else { return this .em.merge(entity); } } ..... } Create a test class. @RunWith (SpringJUnit4ClassRu...