/** * Sets the transaction to rollback. */ protected final void setRollbackOnly() { this.emfWork.setRollbackOnly(); }
@Test @DataSet("AbstractDbTestTransactionTest_testingEntity.xml") @DataVerify @DataSetExport(tablesDataSet="AbstractDbTestTransactionTest_testingEntity.xml", doPhysicalExport=false) public void multipleTransactions_areSupported() { // H2 has a locking strategy that will cause a timeout in this scenario JuAssumeUtils.dbIsNot(this.emUtil, DbType.H2); TestingEntity te1 = new TestingEntity("TE1"); this.em.persist(te1); try (EmfWork ew2 = this.startNewWork()) { TestingEntity te2 = new TestingEntity("TE2"); ew2.getEm().persist(te2); try (EmfWork ew3 = this.startNewWork()) { TestingEntity te3 = new TestingEntity("TE3"); ew3.getEm().persist(te3); } ew2.setRollbackOnly(); } } public static class MultipleTransactions_areSupported extends DataVerifier {