diff --git a/ebean-api/src/main/java/io/ebean/Transaction.java b/ebean-api/src/main/java/io/ebean/Transaction.java index d4918e84e..d3e918c0d 100644 --- a/ebean-api/src/main/java/io/ebean/Transaction.java +++ b/ebean-api/src/main/java/io/ebean/Transaction.java @@ -339,15 +339,12 @@ public interface Transaction extends AutoCloseable { * The batch is automatically flushed when it hits the batch size and also when we * execute queries or when we mix UpdateSql and CallableSql with save and delete of * beans. - *
** We use {@link #flush()} to explicitly flush the batch and we can use * {@link #setFlushOnQuery(boolean)} and {@link #setFlushOnMixed(boolean)} * to control the automatic flushing behaviour. - *
** Example: batch processing of CallableSql executing every 10 rows - *
* *{@code
*
@@ -392,14 +389,11 @@ public interface Transaction extends AutoCloseable {
*
* This only takes effect when batch mode on the transaction has not already meant that
* JDBC batch mode is being used.
- *
*
* This is useful when the single save() or delete() cascades. For example, inserting a 'master' cascades
* and inserts a collection of 'detail' beans. The detail beans can be inserted using JDBC batch.
- *
*
* This is effectively already turned on for all platforms apart from older Sql Server.
- *
*
* @param batchMode the batch mode to use per save(), insert(), update() or delete()
* @see io.ebean.config.DatabaseConfig#setPersistBatchOnCascade(PersistBatch)
@@ -422,15 +416,19 @@ public interface Transaction extends AutoCloseable {
int getBatchSize();
/**
- * Specify if you want batched inserts to use getGeneratedKeys.
+ * Specify if we want batched inserts to use getGeneratedKeys.
*
* By default batched inserts will try to use getGeneratedKeys if it is
* supported by the underlying jdbc driver and database.
- *
*
- * You may want to turn getGeneratedKeys off when you are inserting a large
- * number of objects and you don't care about getting back the ids.
- *
+ * We want to turn off getGeneratedKeys when we are inserting a large
+ * number of objects and we don't care about getting back the ids. In this
+ * way we avoid the extra cost of getting back the generated id values
+ * from the database.
+ *
+ * Note that when we do turn off getGeneratedKeys then we have the limitation
+ * that after a bean has been inserted we are unable to then mutate the bean
+ * and update it in the same transaction as we have not obtained it's id value.
*/
void setGetGeneratedKeys(boolean getGeneratedKeys);
@@ -449,13 +447,11 @@ public interface Transaction extends AutoCloseable {
*
* If you want to execute both WITHOUT having the batch automatically flush
* you need to call this with batchFlushOnMixed = false.
- *
*
* Note that UpdateSql and CallableSql are ALWAYS executed first (before the
* beans are executed). This is because the UpdateSql and CallableSql have
* already been bound to their PreparedStatements. The beans on the other hand
* have a 2 step process (delayed binding).
- *
*/
void setFlushOnMixed(boolean batchFlushOnMixed);
@@ -473,7 +469,6 @@ public interface Transaction extends AutoCloseable {
*
* Calling this method with batchFlushOnQuery = false means that you can
* execute a query and the batch will not be automatically flushed.
- *
*/
void setFlushOnQuery(boolean batchFlushOnQuery);
@@ -490,7 +485,6 @@ public interface Transaction extends AutoCloseable {
* should be flushed prior to executing a query.
*
* The default is for this to be true.
- *
*/
boolean isFlushOnQuery();
@@ -507,7 +501,6 @@ public interface Transaction extends AutoCloseable {
* flush the batch if you like.
*
* Flushing occurs automatically when:
- *
* * Examples of when a developer may wish to use the connection directly are: * Savepoints, advanced CLOB BLOB use and advanced stored procedure calls. - *
*/ Connection getConnection(); @@ -545,17 +536,14 @@ public interface Transaction extends AutoCloseable { * Add table modification information to the TransactionEvent. ** Use this in conjunction with getConnection() and raw JDBC. - *
** This effectively informs Ebean of the data that has been changed by the * transaction and this information is normally automatically handled by Ebean * when you save entity beans or use UpdateSql etc. - *
** If you use raw JDBC then you can use this method to inform Ebean for the * tables that have been modified. Ebean uses this information to keep its * caches in synch and maintain text indexes. - *
*/ void addModification(String tableName, boolean inserts, boolean updates, boolean deletes);