Package io.ebeaninternal.server.persist
Class DefaultPersister
- java.lang.Object
-
- io.ebeaninternal.server.persist.DefaultPersister
-
- All Implemented Interfaces:
Persister
public final class DefaultPersister extends Object implements Persister
Persister implementation using DML.This object uses DmlPersistExecute to perform the actual persist execution.
This object:
- Determines insert or update for saved beans
- Determines the concurrency mode
- Handles cascading of save and delete
- Handles the batching and queueing
-
-
Constructor Summary
Constructors Constructor Description DefaultPersister(SpiEbeanServer server, Binder binder, BeanDescriptorManager descMgr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBatch(SpiSqlUpdate sqlUpdate, SpiTransaction transaction)
Add the statement to JDBC batch for later execution via executeBatch.void
addToFlushQueue(SpiSqlUpdate update, SpiTransaction t)
Queue the SqlUpdate for early execution (with JDBC batch).void
addToFlushQueueLast(SpiSqlUpdate update, SpiTransaction t)
Queue the SqlUpdate for late execution (with JDBC batch).int
delete(EntityBean bean, Transaction t, boolean permanent)
Delete the bean with the explicit transaction.int
delete(Class<?> beanType, Object id, Transaction transaction, boolean permanent)
Delete by Id.int
deleteByIds(BeanDescriptor<?> descriptor, List<Object> idList, Transaction transaction, boolean permanent)
Delete multiple beans when escalated from a delete query.int
deleteMany(Class<?> beanType, Collection<?> ids, Transaction transaction, boolean permanent)
Delete by a List of Id's.<T> List<T>
draftRestore(Query<T> query, Transaction transaction)
Restore draft beans to match live beans given the query.int[]
executeBatch(SpiSqlUpdate sqlUpdate, SpiTransaction transaction)
Execute the associated batched statement.int
executeCallable(CallableSql callSql, Transaction t)
Execute the CallableSql.int
executeOrmUpdate(Update<?> update, Transaction t)
Execute the orm update.void
executeOrQueue(SpiSqlUpdate update, SpiTransaction t, boolean queue)
Execute or queue the update.int
executeSqlUpdate(SqlUpdate updSql, Transaction t)
Execute the updateSql.int
executeSqlUpdateNow(SpiSqlUpdate updSql, Transaction t)
Execute the SqlUpdate now regardless of transaction batch mode.void
insert(EntityBean bean, Transaction t)
Insert this bean.int
merge(BeanDescriptor<?> desc, EntityBean bean, MergeOptions options, SpiTransaction transaction)
Merge the bean.<T> List<T>
publish(Query<T> query, Transaction transaction)
Publish from draft to live given the query.void
save(EntityBean bean, Transaction t)
Insert or update the bean.void
update(EntityBean entityBean, Transaction t)
Update the bean.void
visitMetrics(MetricVisitor visitor)
Visit the metrics.
-
-
-
Constructor Detail
-
DefaultPersister
public DefaultPersister(SpiEbeanServer server, Binder binder, BeanDescriptorManager descMgr)
-
-
Method Detail
-
visitMetrics
public void visitMetrics(MetricVisitor visitor)
Description copied from interface:Persister
Visit the metrics.- Specified by:
visitMetrics
in interfacePersister
-
executeCallable
public int executeCallable(CallableSql callSql, Transaction t)
Execute the CallableSql.- Specified by:
executeCallable
in interfacePersister
-
executeOrmUpdate
public int executeOrmUpdate(Update<?> update, Transaction t)
Execute the orm update.- Specified by:
executeOrmUpdate
in interfacePersister
-
addBatch
public void addBatch(SpiSqlUpdate sqlUpdate, SpiTransaction transaction)
Description copied from interface:Persister
Add the statement to JDBC batch for later execution via executeBatch.
-
executeBatch
public int[] executeBatch(SpiSqlUpdate sqlUpdate, SpiTransaction transaction)
Description copied from interface:Persister
Execute the associated batched statement.- Specified by:
executeBatch
in interfacePersister
-
executeOrQueue
public void executeOrQueue(SpiSqlUpdate update, SpiTransaction t, boolean queue)
Description copied from interface:Persister
Execute or queue the update.- Specified by:
executeOrQueue
in interfacePersister
-
addToFlushQueue
public void addToFlushQueue(SpiSqlUpdate update, SpiTransaction t)
Description copied from interface:Persister
Queue the SqlUpdate for early execution (with JDBC batch).- Specified by:
addToFlushQueue
in interfacePersister
-
addToFlushQueueLast
public void addToFlushQueueLast(SpiSqlUpdate update, SpiTransaction t)
Description copied from interface:Persister
Queue the SqlUpdate for late execution (with JDBC batch).- Specified by:
addToFlushQueueLast
in interfacePersister
-
executeSqlUpdate
public int executeSqlUpdate(SqlUpdate updSql, Transaction t)
Execute the updateSql.- Specified by:
executeSqlUpdate
in interfacePersister
-
executeSqlUpdateNow
public int executeSqlUpdateNow(SpiSqlUpdate updSql, Transaction t)
Description copied from interface:Persister
Execute the SqlUpdate now regardless of transaction batch mode.- Specified by:
executeSqlUpdateNow
in interfacePersister
-
draftRestore
public <T> List<T> draftRestore(Query<T> query, Transaction transaction)
Restore draft beans to match live beans given the query.- Specified by:
draftRestore
in interfacePersister
-
publish
public <T> List<T> publish(Query<T> query, Transaction transaction)
Publish from draft to live given the query.
-
merge
public int merge(BeanDescriptor<?> desc, EntityBean bean, MergeOptions options, SpiTransaction transaction)
Description copied from interface:Persister
Merge the bean.
-
update
public void update(EntityBean entityBean, Transaction t)
Update the bean.
-
save
public void save(EntityBean bean, Transaction t)
Insert or update the bean.
-
insert
public void insert(EntityBean bean, Transaction t)
Insert this bean.
-
delete
public int delete(EntityBean bean, Transaction t, boolean permanent)
Delete the bean with the explicit transaction. Return false if the delete is executed without OCC and 0 rows were deleted.
-
deleteMany
public int deleteMany(Class<?> beanType, Collection<?> ids, Transaction transaction, boolean permanent)
Delete by a List of Id's.- Specified by:
deleteMany
in interfacePersister
-
delete
public int delete(Class<?> beanType, Object id, Transaction transaction, boolean permanent)
Delete by Id.
-
deleteByIds
public int deleteByIds(BeanDescriptor<?> descriptor, List<Object> idList, Transaction transaction, boolean permanent)
Description copied from interface:Persister
Delete multiple beans when escalated from a delete query.- Specified by:
deleteByIds
in interfacePersister
-
-