Add test for transaction Propagation.REQUIRES_NEW

This commit is contained in:
rob bygrave
2020-12-21 14:45:13 +13:00
parent 7077e92cb0
commit bf0c8d8dab
3 changed files with 14 additions and 1 deletions
@@ -62,10 +62,14 @@ public class EbeanSpringModuleTest {
@Test
public void testBatchInsert() {
userService.batchInsert();
}
@Test
public void testRequiresNew() {
userService.requiresNew();
}
/**
* Test app.
*/
@@ -14,4 +14,6 @@ public interface UserService {
void nonTransactional();
void batchInsert();
void requiresNew();
}
@@ -59,6 +59,13 @@ public class UserServiceImpl implements UserService {
System.out.println("---------after batch-------");
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void requiresNew() {
User user = new User();
user.setName("user_x0");
ebeanServer.save(user);
}
/**
* Return the ebean server.