Initial experimental support for "transparent persistence"

In short, when this is turned on at flush() get any dirty beans held by the PersistenceContext and persist them (always update for these beans)
This commit is contained in:
Robin Bygrave
2021-04-01 14:47:54 +13:00
parent 7fc4a229ae
commit a617d58902
14 changed files with 303 additions and 13 deletions
@@ -59,6 +59,14 @@ public interface Transaction extends AutoCloseable {
*/
void register(TransactionCallback callback);
/**
* EXPERIMENTAL - turn on transparent persistence and batchMode true.
* <p>
* With this turned on beans that are dirty in the persistence context
* are automatically persisted on flush() and commit().
*/
void setTransparentPersistence(boolean transparentPersistence);
/**
* Set a label on the transaction.
* <p>
@@ -1,5 +1,7 @@
package io.ebean.bean;
import java.util.List;
/**
* Holds entity beans by there type and id.
* <p>
@@ -77,6 +79,11 @@ public interface PersistenceContext {
*/
boolean resetLimit();
/**
* Return the list of dirty beans held by this persistence context.
*/
List<Object> dirtyBeans();
/**
* Wrapper on a bean to also indicate if a bean has been deleted.
* <p>