public interface SpiTransaction extends Transaction
Provides support for batching and TransactionContext.
READ_COMMITTED, READ_UNCOMMITTED, REPEATABLE_READ, SERIALIZABLE| Modifier and Type | Method and Description |
|---|---|
int |
depth(int diff)
Modify and return the current 'depth' of the transaction.
|
BatchControl |
getBatchControl()
Return the queue used to batch up persist requests.
|
int |
getBatchSize()
Return the batchSize specifically set for this transaction or 0.
|
List<DerivedRelationshipData> |
getDerivedRelationship(Object bean)
Return the list of "Derived Relationships" that must be maintained after
insert.
|
TransactionEvent |
getEvent()
Get the object that holds the event details.
|
String |
getId()
Returns a String used to identify the transaction.
|
Connection |
getInternalConnection()
Return the underlying Connection for internal use.
|
String |
getLogPrefix()
Return the string prefix with the transactin id and label used in logging.
|
PersistenceContext |
getPersistenceContext()
Return the persistence context associated with this transaction.
|
boolean |
isBatchThisRequest()
Return true if this request should be batched.
|
boolean |
isExplicit()
Return true if this transaction was created explicitly via
Ebean.beginTransaction(). |
boolean |
isLogSql()
Return true if generated SQL and Bind values should be logged to the
transaction log.
|
boolean |
isLogSummary()
Return true if summary level events should be logged to the transaction
log.
|
boolean |
isPersistCascade()
Whether persistCascade is on for save and delete.
|
boolean |
isRegisteredBean(Object bean)
Return true if this is a bean that has already been persisted in the
current recursive save request.
|
boolean |
isRegisteredDeleteBean(Integer hash)
Return true if this is a bean that has already been saved/deleted.
|
boolean |
isSaveAssocManyIntersection(String intersectionTable,
String beanName)
Return true if the manyToMany intersection should be persisted for this particular relationship direction.
|
void |
logSql(String msg)
Log a message to the SQL logger.
|
void |
logSummary(String msg)
Log a message to the SUMMARY logger.
|
void |
registerDeleteBean(Integer hash)
Add a deleting bean to the registered list.
|
void |
registerDerivedRelationship(DerivedRelationshipData assocBean)
Register a "Derived Relationship" (that requires an additional update).
|
void |
setBatchControl(BatchControl control)
Set the queue used to batch up persist requests.
|
void |
setPersistenceContext(PersistenceContext context)
Set the persistence context to this transaction.
|
void |
unregisterBean(Object bean)
Unregister the persisted bean.
|
void |
unregisterDeleteBean(Integer hash)
Unregister the hash of the bean.
|
addModification, batchFlush, commit, end, flushBatch, getConnection, getUserObject, isActive, isBatchFlushOnQuery, isReadOnly, putUserObject, rollback, rollback, setBatchFlushOnMixed, setBatchFlushOnQuery, setBatchGetGeneratedKeys, setBatchMode, setBatchSize, setPersistCascade, setReadOnlyString getLogPrefix()
boolean isLogSql()
boolean isLogSummary()
void logSql(String msg)
void logSummary(String msg)
void registerDerivedRelationship(DerivedRelationshipData assocBean)
List<DerivedRelationshipData> getDerivedRelationship(Object bean)
void registerDeleteBean(Integer hash)
This is to handle bi-directional relationships where both sides Cascade.
void unregisterDeleteBean(Integer hash)
boolean isRegisteredDeleteBean(Integer hash)
void unregisterBean(Object bean)
boolean isRegisteredBean(Object bean)
This will register the bean if it is not already.
String getId()
int getBatchSize()
Returning 0 implies to use the system wide default batch size.
int depth(int diff)
As we cascade save or delete we traverse the object graph tree. Going up to Assoc Ones the depth decreases and going down to Assoc Manys the depth increases.
The depth is used for ordering batching statements. The lowest depth get executed first during save.
boolean isExplicit()
Ebean.beginTransaction().TransactionEvent getEvent()
This information is used maintain the table state, cache and text indexes. On commit the Table modifications this generates is broadcast around the cluster (if you have a cluster).
boolean isPersistCascade()
boolean isBatchThisRequest()
BatchControl getBatchControl()
void setBatchControl(BatchControl control)
PersistenceContext getPersistenceContext()
You may wish to hold onto this and set it against another transaction later. This is along the lines of 'extended persistence context' behaviour.
void setPersistenceContext(PersistenceContext context)
This could be considered similar to 'EJB3 Extended Persistence Context'. In that you can get the PersistenceContext from a transaction, hold onto it, and then set it back later to a second transaction. In general there is one PersistenceContext per Transaction. The getPersistenceContext() and setPersistenceContext() enable a developer to reuse a single PersistenceContext with multiple transactions.
Connection getInternalConnection()
If the connection is made public from Transaction and the user code calls that method we can no longer trust the query only status of a Transaction.
Copyright © 2014. All Rights Reserved.