#568 - ENH: Add ability to turn of getGeneratedKeys with @Transactional annotation (Also needs agent update)

This commit is contained in:
Robin Bygrave
2016-05-16 15:50:11 +12:00
parent dd28b28095
commit ec234f1f39
8 changed files with 253 additions and 169 deletions
@@ -15,7 +15,7 @@ public class BaseTestCase {
logger.debug("... preStart");
if (!AgentLoader.loadAgentFromClasspath("avaje-ebeanorm-agent","debug=0;packages=com.avaje.tests.**,org.avaje.test.**")) {
logger.info("avaje-ebeanorm-agent not found in classpath - not dynamically loaded");
}
}
}
/**
@@ -13,6 +13,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
//import static org.assertj.core.api.Assertions.assertThat;
//import static org.junit.Assert.assertNull;
public class TestBatchInsertSimple extends BaseTestCase {
Random random = new Random();
@@ -63,6 +66,35 @@ public class TestBatchInsertSimple extends BaseTestCase {
}
}
// @Test
// public void testTransactional_skipGeneratedBeans() {
//
// if (isMsSqlServer()) return;
//
// List<UTMaster> beans = saveWithFullBatchMode_skipGeneratedKeys();
// for (UTMaster bean : beans) {
// assertNull(bean.getId());
// }
// }
//
// @Transactional(batch=PersistBatch.ALL, batchSize=50, getGeneratedKeys = false)
// public List<UTMaster> saveWithFullBatchMode_skipGeneratedKeys() {
//
// Transaction transaction = server().currentTransaction();
// SpiTransaction spiTxn = (SpiTransaction)transaction;
// Boolean generatedKeys = spiTxn.getBatchGetGeneratedKeys();
//
// assertThat(generatedKeys).isFalse();
//
// List<UTMaster> beans = new ArrayList<UTMaster>();
// for (int i = 0; i < 4; i++) {
// beans.add(createMaster(i));
// }
//
// server().saveAll(beans);
// return beans;
// }
@Test
public void testJdbcBatchPerRequestWithMasterOnly() {