Beispiel #1
0
 @Transactional(propagation = Propagation.MANDATORY)
 @JpaUnit("unit1")
 protected void access_to_unit1_with_current_transaction() {
   Item1 item1 = new Item1();
   item1.setID(40L);
   item1.setName("item1Name");
   item1Repository.save(item1);
   Assertions.assertThat(item1.getID()).isEqualTo(40L);
 }
Beispiel #2
0
  @Test
  @Transactional
  @JpaUnit("unit1")
  public void access_to_unit2_with_new_transaction_should_succeed() throws Exception {
    Item1 item1 = new Item1();
    item1.setID(20L);
    item1.setName("item1Name");
    item1Repository.save(item1);
    Assertions.assertThat(item1.getID()).isEqualTo(20L);

    access_to_unit2_with_new_transaction();

    access_to_unit1_with_current_transaction();
  }