public class PersistRequestBean<T> extends PersistRequest implements BeanPersistRequest<T>
PersistRequest.Type| Modifier and Type | Field and Description |
|---|---|
protected T |
bean
The bean being persisted.
|
protected BeanDescriptor<T> |
beanDescriptor |
protected Integer |
beanHash
Hash value used to handle cascade delete both ways in a relationship.
|
protected Integer |
beanIdentityHash |
protected BeanManager<T> |
beanManager |
protected BeanPersistListener<T> |
beanPersistListener |
protected Set<String> |
changedProps |
protected ConcurrencyMode |
concurrencyMode
The concurrency mode used for update or delete.
|
protected BeanPersistController |
controller
For per post insert update delete control.
|
protected Object |
idValue
The unique id used for logging summary.
|
protected EntityBeanIntercept |
intercept
The associated intercept.
|
protected boolean |
isDirty |
protected Set<String> |
loadedProps |
protected boolean |
notifyCache |
protected T |
oldValues
Old values used for concurrency checking.
|
protected Object |
parentBean
The parent bean for unidirectional save.
|
| Constructor and Description |
|---|
PersistRequestBean(SpiEbeanServer server,
T bean,
Object parentBean,
BeanManager<T> mgr,
SpiTransaction t,
PersistExecute persistExecute) |
PersistRequestBean(SpiEbeanServer server,
T bean,
Object parentBean,
BeanManager<T> mgr,
SpiTransaction t,
PersistExecute persistExecute,
Set<String> updateProps,
ConcurrencyMode concurrencyMode)
Used for forced update of a bean.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToPersistMap(BeanPersistIdMap beanPersistMap) |
void |
checkRowCount(int rowCount)
Check for optimistic concurrency exception.
|
BeanDelta |
createDeltaBean() |
GenerateDmlRequest |
createGenerateDmlRequest(boolean emptyStringAsNull)
Create a GenerateDmlRequest used to generate the DML.
|
ConcurrencyMode |
determineConcurrencyMode()
Determine the concurrency mode depending on fully/partially populated
bean.
|
int |
executeNow()
Execute the request right now.
|
int |
executeOrQueue()
Execute a the request or queue/batch it for later execution.
|
T |
getBean()
Return the bean associated with this request.
|
BeanPersistController |
getBeanController()
Return the controller if there is one associated with this type of bean.
|
BeanDescriptor<T> |
getBeanDescriptor()
Return the BeanDescriptor for the associated bean.
|
Object |
getBeanId()
Return the Id value for the bean.
|
BeanManager<T> |
getBeanManager() |
ConcurrencyMode |
getConcurrencyMode()
Return the concurrency mode used for this persist.
|
List<DerivedRelationshipData> |
getDerivedRelationships() |
EntityBeanIntercept |
getEntityBeanIntercept()
Return the intercept if there is one.
|
String |
getFullName()
Returns a description of the request.
|
Set<String> |
getLoadedProperties()
For an update or delete of a partially populated bean this is the set of
loaded properties and otherwise returns null.
|
T |
getOldValues()
Get the old values bean.
|
Object |
getParentBean()
Return the parent bean for cascading save with unidirectional
relationship.
|
Set<String> |
getUpdatedProperties()
Return the updated properties.
|
boolean |
hasChanged(BeanProperty prop)
Test if the property value has changed and if so include it in the
update.
|
boolean |
isDeleteMissingChildren()
Return true if a stateless update should also delete any missing details
beans.
|
boolean |
isDirty()
Used to skip updates if we know the bean is not dirty.
|
boolean |
isDynamicUpdateSql()
Return true if the update DML/SQL must be dynamically generated.
|
boolean |
isLoadedProperty(BeanProperty prop)
Return true if this property is loaded (full bean or included in partial
bean).
|
boolean |
isNotify(TransactionEvent txnEvent) |
boolean |
isNotifyCache() |
boolean |
isNotifyPersistListener() |
boolean |
isParent(Object o) |
boolean |
isRegisteredBean()
Return true if this bean has been already been persisted
(inserted/updated or deleted) in this transaction.
|
boolean |
isRegisteredForDeleteBean() |
boolean |
isStatelessUpdate()
Return true if this is a stateless update.
|
boolean |
isUpdateNullProperties()
Return true if null properties should be updated (treated as loaded) for
stateless updates.
|
void |
notifyCache()
Notify/Update the local L2 cache after the transaction has successfully committed.
|
boolean |
notifyLocalPersistListener() |
void |
postDelete() |
void |
postExecute()
Post processing.
|
void |
registerDeleteBean() |
void |
setBoundId(Object idValue)
Set the Id value that was bound.
|
void |
setGeneratedKey(Object idValue)
Set the generated key back to the bean.
|
void |
setLoadedProps(Set<String> additionalProps)
Set loaded properties when generated values has added properties such as
created and updated timestamps.
|
void |
setStatelessUpdate(boolean statelessUpdate,
boolean deleteMissingChildren,
boolean updateNullProperties)
Set to true if this is a stateless update.
|
void |
setType(PersistRequest.Type type)
Set the type of this request.
|
void |
unRegisterBean() |
void |
unregisterDeleteBean() |
executeStatement, getPstmtBatch, getType, initTransIfRequired, isLogSql, isLogSummary, isPersistCascadecommitTransIfRequired, createImplicitTransIfRequired, getConnection, getEbeanServer, getServer, getTransaction, rollbackTransIfRequiredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEbeanServer, getTransactionprotected final BeanManager<T> beanManager
protected final BeanDescriptor<T> beanDescriptor
protected final BeanPersistListener<T> beanPersistListener
protected final BeanPersistController controller
protected final EntityBeanIntercept intercept
protected final Object parentBean
protected final boolean isDirty
protected final T bean
protected T oldValues
protected ConcurrencyMode concurrencyMode
protected Object idValue
protected Integer beanHash
protected Integer beanIdentityHash
protected boolean notifyCache
public PersistRequestBean(SpiEbeanServer server, T bean, Object parentBean, BeanManager<T> mgr, SpiTransaction t, PersistExecute persistExecute, Set<String> updateProps, ConcurrencyMode concurrencyMode)
public PersistRequestBean(SpiEbeanServer server, T bean, Object parentBean, BeanManager<T> mgr, SpiTransaction t, PersistExecute persistExecute)
public boolean isNotify(TransactionEvent txnEvent)
public boolean isNotifyCache()
public boolean isNotifyPersistListener()
public void notifyCache()
public void addToPersistMap(BeanPersistIdMap beanPersistMap)
public boolean notifyLocalPersistListener()
public boolean isParent(Object o)
public boolean isRegisteredBean()
public void unRegisterBean()
public void registerDeleteBean()
public void unregisterDeleteBean()
public boolean isRegisteredForDeleteBean()
public void setType(PersistRequest.Type type)
setType in class PersistRequestpublic BeanManager<T> getBeanManager()
public BeanDescriptor<T> getBeanDescriptor()
public boolean isStatelessUpdate()
public boolean isDeleteMissingChildren()
public boolean isUpdateNullProperties()
public void setStatelessUpdate(boolean statelessUpdate,
boolean deleteMissingChildren,
boolean updateNullProperties)
By Stateless it means that the bean was not previously fetched (and so does not have it's previous state) so we are doing an update on a bean that was probably created from JSON or XML.
public boolean isDirty()
public ConcurrencyMode getConcurrencyMode()
public void setLoadedProps(Set<String> additionalProps)
public Set<String> getLoadedProperties()
BeanPersistRequestgetLoadedProperties in interface BeanPersistRequest<T>public String getFullName()
Used to determine common persist requests for queueing and statement batching.
public T getBean()
getBean in interface BeanPersistRequest<T>public Object getBeanId()
public BeanDelta createDeltaBean()
public T getOldValues()
getOldValues in interface BeanPersistRequest<T>public Object getParentBean()
public BeanPersistController getBeanController()
public EntityBeanIntercept getEntityBeanIntercept()
public boolean isLoadedProperty(BeanProperty prop)
public int executeNow()
PersistRequestexecuteNow in class PersistRequestpublic int executeOrQueue()
PersistRequestexecuteOrQueue in class PersistRequestpublic void setGeneratedKey(Object idValue)
setGeneratedKey in interface BatchPostExecutepublic void setBoundId(Object idValue)
public final void checkRowCount(int rowCount)
throws SQLException
checkRowCount in interface BatchPostExecuteSQLExceptionpublic void postDelete()
public void postExecute()
throws SQLException
postExecute in interface BatchPostExecuteSQLExceptionpublic ConcurrencyMode determineConcurrencyMode()
Specifically with version concurrency we want to check that the version property was one of the loaded properties.
public boolean isDynamicUpdateSql()
This is the case for updates/deletes of partially populated beans.
public GenerateDmlRequest createGenerateDmlRequest(boolean emptyStringAsNull)
Will used changed properties or loaded properties depending on the BeanDescriptor.isUpdateChangesOnly() value.
public Set<String> getUpdatedProperties()
getUpdatedProperties in interface BeanPersistRequest<T>public boolean hasChanged(BeanProperty prop)
public List<DerivedRelationshipData> getDerivedRelationships()
Copyright © 2014. All Rights Reserved.