@java.lang.SuppressWarnings({"rawtypes", "unchecked"}) public abstract class AbstractSession extends AbstractAttributeStoringSession
Abstract implementation of the Session interface that uses a list of Persister instances to save, update and delete instances
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
ENTITY_ACCESS |
|
protected TPCacheAdapterRepository |
cacheAdapterRepository |
|
protected java.util.Map<java.lang.Class, java.util.Map<java.io.Serializable, java.lang.Object>> |
firstLevelCache |
|
protected java.util.Map<CollectionKey, java.util.Collection> |
firstLevelCollectionCache |
|
protected java.util.Map<java.lang.Class, java.util.Map<java.io.Serializable, java.lang.Object>> |
firstLevelEntryCache |
|
protected java.util.Map<java.lang.Class, java.util.Map<java.io.Serializable, java.lang.Object>> |
firstLevelEntryCacheDirtyCheck |
|
protected boolean |
flushActive |
|
protected boolean |
isSynchronizedWithTransaction |
|
protected java.util.concurrent.ConcurrentLinkedQueue |
lockedObjects |
|
protected java.util.Map<java.lang.Class, Persister> |
persisters |
|
protected java.util.Collection<java.lang.Runnable> |
postFlushOperations |
|
protected org.springframework.context.ApplicationEventPublisher |
publisher |
|
protected boolean |
stateless |
|
protected Transaction |
transaction |
Fields inherited from class | Fields |
---|---|
class AbstractAttributeStoringSession |
attributes, sessionPropertyMap |
Constructor and description |
---|
AbstractSession
(Datastore datastore, MappingContext mappingContext, org.springframework.context.ApplicationEventPublisher publisher) |
AbstractSession
(Datastore datastore, MappingContext mappingContext, org.springframework.context.ApplicationEventPublisher publisher, boolean stateless) |
AbstractSession
(Datastore datastore, MappingContext mappingContext, org.springframework.context.ApplicationEventPublisher publisher, TPCacheAdapterRepository cacheAdapterRepository) |
AbstractSession
(Datastore datastore, MappingContext mappingContext, org.springframework.context.ApplicationEventPublisher publisher, TPCacheAdapterRepository cacheAdapterRepository, boolean stateless) |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
addPendingDelete(PendingDelete delete) |
|
void |
addPendingInsert(PendingInsert insert) |
|
void |
addPendingUpdate(PendingUpdate update) |
|
void |
addPostFlushOperation(java.lang.Runnable runnable) |
|
void |
attach(java.lang.Object o) |
|
Transaction |
beginTransaction() |
|
Transaction |
beginTransaction(org.springframework.transaction.TransactionDefinition definition) |
|
protected Transaction |
beginTransactionInternal() |
|
void |
cacheCollection(PersistentEntity entity, java.io.Serializable key, java.util.Collection collection, java.lang.String name) |
|
void |
cacheEntry(PersistentEntity entity, java.io.Serializable key, java.lang.Object entry) |
|
protected void |
cacheEntry(java.io.Serializable key, java.lang.Object entry, java.util.Map<java.io.Serializable, java.lang.Object> entryCache, boolean forDirtyCheck) |
|
void |
cacheInstance(java.lang.Class type, java.io.Serializable key, java.lang.Object instance) |
|
protected void |
cacheObject(java.io.Serializable identifier, java.lang.Object o) |
|
void |
clear() |
|
void |
clear(java.lang.Object o) |
|
protected void |
clearPendingOperations() |
|
boolean |
contains(java.lang.Object o) |
|
protected java.io.Serializable |
convertIdentityIfNecessasry(PersistentProperty identity, java.io.Serializable key) |
|
EntityAccess |
createEntityAccess(PersistentEntity entity, java.lang.Object instance) |
|
protected Persister |
createPersister(java.lang.Class cls, MappingContext mappingContext) |
|
Query |
createQuery(java.lang.Class type) |
|
void |
delete(java.lang.Object obj) |
|
void |
delete(java.lang.Iterable objects) |
|
long |
deleteAll(QueryableCriteria criteria) This default implementation of the deleteAll method is unlikely to be optimal as it iterates and deletes each object. |
|
protected void |
executePendings(java.util.Collection<? extends java.lang.Runnable> pendings) |
|
void |
flush() |
|
protected void |
flushPendingDeletes(java.util.Map<PersistentEntity, java.util.Collection<PendingDelete>> pendingDeletes) |
|
protected void |
flushPendingInserts(java.util.Map<PersistentEntity, java.util.Collection<PendingInsert>> inserts) The default implementation of flushPendingInserts is to iterate over each insert operations and execute them one by one. |
|
protected void |
flushPendingUpdates(java.util.Map<PersistentEntity, java.util.Collection<PendingUpdate>> updates) The default implementation of flushPendingUpdates is to iterate over each update operation and execute them one by one. |
|
java.util.Collection |
getCachedCollection(PersistentEntity entity, java.io.Serializable key, java.lang.String name) |
|
java.lang.Object |
getCachedEntry(PersistentEntity entity, java.io.Serializable key) |
|
java.lang.Object |
getCachedEntry(PersistentEntity entity, java.io.Serializable key, boolean forDirtyCheck) |
|
java.lang.Object |
getCachedInstance(java.lang.Class type, java.io.Serializable key) |
|
Datastore |
getDatastore() |
|
javax.persistence.FlushModeType |
getFlushMode() |
|
MappingContext |
getMappingContext() |
|
java.io.Serializable |
getObjectIdentifier(java.lang.Object instance) |
|
java.util.Map<PersistentEntity, java.util.Collection<PendingDelete>> |
getPendingDeletes() |
|
java.util.Map<PersistentEntity, java.util.Collection<PendingInsert>> |
getPendingInserts() |
|
java.util.Map<PersistentEntity, java.util.Collection<PendingUpdate>> |
getPendingUpdates() |
|
Persister |
getPersister(java.lang.Object o) |
|
Transaction |
getTransaction() |
|
boolean |
hasTransaction() |
|
java.io.Serializable |
insert(java.lang.Object o) |
|
boolean |
isCached(java.lang.Class type, java.io.Serializable key) |
|
boolean |
isDirty(java.lang.Object instance) |
|
boolean |
isPendingAlready(java.lang.Object obj) |
|
boolean |
isSchemaless() |
|
boolean |
isStateless() |
|
boolean |
isStateless(PersistentEntity entity) |
|
void |
lock(java.lang.Object o) |
|
java.lang.Object |
lock(java.lang.Class type, java.io.Serializable key) |
|
java.io.Serializable |
persist(java.lang.Object o) |
|
java.util.List<java.io.Serializable> |
persist(java.lang.Iterable objects) |
|
protected void |
postFlush(boolean hasUpdates) |
|
java.lang.Object |
proxy(java.lang.Class type, java.io.Serializable key) |
|
void |
refresh(java.lang.Object o) |
|
void |
registerPending(java.lang.Object obj) |
|
java.lang.Object |
retrieve(java.lang.Class type, java.io.Serializable key) |
|
java.util.List |
retrieveAll(java.lang.Class type, java.lang.Iterable keys) |
|
java.util.List |
retrieveAll(java.lang.Class type, java.io.Serializable... keys) |
|
void |
setFlushMode(javax.persistence.FlushModeType flushMode) |
|
void |
setSynchronizedWithTransaction(boolean isSynchronizedWithTransaction) Whether the session is synchronized with an external transaction |
|
void |
unlock(java.lang.Object o) |
|
long |
updateAll(QueryableCriteria criteria, java.util.Map<java.lang.String, java.lang.Object> properties) This default implementation of updateAll is unlikely to be optimal as it iterates and updates each object one by one. |
Methods inherited from class | Name |
---|---|
class AbstractAttributeStoringSession |
clearSessionProperty, disconnect, getAttribute, getSessionProperty, isConnected, removeAttributesForEntity, setAttribute, setSessionProperty |
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
This default implementation of the deleteAll method is unlikely to be optimal as it iterates and deletes each object. Subclasses should override to optimize for the batch operation capability of the underlying datastore
criteria
- The criteriaThe default implementation of flushPendingInserts is to iterate over each insert operations and execute them one by one. This may be suboptimal for stores that support batch insert operations. Subclasses can override this method to implement batch insert more efficiently.
inserts
- The insert operationsThe default implementation of flushPendingUpdates is to iterate over each update operation and execute them one by one. This may be suboptimal for stores that support batch update operations. Subclasses can override this method to implement batch update more efficiently.
Whether the session is synchronized with an external transaction
isSynchronizedWithTransaction
- True if it isThis default implementation of updateAll is unlikely to be optimal as it iterates and updates each object one by one. Subclasses should override to optimize for the batch operation capability of the underlying datastore
criteria
- The criteriaproperties
- The properties