@java.lang.SuppressWarnings({"rawtypes", "unchecked"}) public abstract class AbstractSession<N> extends AbstractAttributeStoringSession implements SessionImplementor
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 |
---|---|---|
|
public void |
addPendingDelete(PendingDelete delete) |
|
public void |
addPendingInsert(PendingInsert insert) |
|
public void |
addPendingUpdate(PendingUpdate update) |
|
public void |
addPostFlushOperation(java.lang.Runnable runnable) |
|
public void |
attach(java.lang.Object o) |
|
public final Transaction |
beginTransaction() |
|
public Transaction |
beginTransaction(org.springframework.transaction.TransactionDefinition definition) |
|
protected abstract Transaction |
beginTransactionInternal() |
|
public void |
cacheCollection(PersistentEntity entity, java.io.Serializable key, java.util.Collection collection, java.lang.String name) |
|
public 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) |
|
public 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) |
|
public void |
clear() |
|
public void |
clear(java.lang.Object o) |
|
protected void |
clearPendingOperations() |
|
public boolean |
contains(java.lang.Object o) |
|
protected java.io.Serializable |
convertIdentityIfNecessasry(PersistentProperty identity, java.io.Serializable key) |
|
public EntityAccess |
createEntityAccess(PersistentEntity entity, java.lang.Object instance) |
|
protected abstract Persister |
createPersister(java.lang.Class cls, MappingContext mappingContext) |
|
public Query |
createQuery(java.lang.Class type) |
|
public void |
delete(java.lang.Object obj) |
|
public void |
delete(java.lang.Iterable objects) |
|
public 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) |
|
public 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. |
|
public java.util.Collection |
getCachedCollection(PersistentEntity entity, java.io.Serializable key, java.lang.String name) |
|
public java.lang.Object |
getCachedEntry(PersistentEntity entity, java.io.Serializable key) |
|
public java.lang.Object |
getCachedEntry(PersistentEntity entity, java.io.Serializable key, boolean forDirtyCheck) |
|
public java.lang.Object |
getCachedInstance(java.lang.Class type, java.io.Serializable key) |
|
public Datastore |
getDatastore() |
|
public javax.persistence.FlushModeType |
getFlushMode() |
|
public MappingContext |
getMappingContext() |
|
public java.io.Serializable |
getObjectIdentifier(java.lang.Object instance) |
|
public java.util.Map<PersistentEntity, java.util.Collection<PendingDelete>> |
getPendingDeletes() |
|
public java.util.Map<PersistentEntity, java.util.Collection<PendingInsert>> |
getPendingInserts() |
|
public java.util.Map<PersistentEntity, java.util.Collection<PendingUpdate>> |
getPendingUpdates() |
|
public final Persister |
getPersister(java.lang.Object o) |
|
public Transaction |
getTransaction() |
|
public boolean |
hasTransaction() |
|
public java.io.Serializable |
insert(java.lang.Object o) |
|
public boolean |
isCached(java.lang.Class type, java.io.Serializable key) |
|
public boolean |
isDirty(java.lang.Object instance) |
|
public boolean |
isPendingAlready(java.lang.Object obj) |
|
public boolean |
isSchemaless() |
|
public boolean |
isStateless() |
|
public boolean |
isStateless(PersistentEntity entity) |
|
public void |
lock(java.lang.Object o) |
|
public java.lang.Object |
lock(java.lang.Class type, java.io.Serializable key) |
|
public java.io.Serializable |
persist(java.lang.Object o) |
|
public java.util.List<java.io.Serializable> |
persist(java.lang.Iterable objects) |
|
protected void |
postFlush(boolean hasUpdates) |
|
public java.lang.Object |
proxy(java.lang.Class type, java.io.Serializable key) |
|
public void |
refresh(java.lang.Object o) |
|
public void |
registerPending(java.lang.Object obj) |
|
public java.lang.Object |
retrieve(java.lang.Class type, java.io.Serializable key) |
|
public java.util.List |
retrieveAll(java.lang.Class type, java.lang.Iterable keys) |
|
public java.util.List |
retrieveAll(java.lang.Class type, java.io.Serializable keys) |
|
public void |
setFlushMode(javax.persistence.FlushModeType flushMode) |
|
public void |
setSynchronizedWithTransaction(boolean isSynchronizedWithTransaction) Whether the session is synchronized with an external transaction |
|
public void |
unlock(java.lang.Object o) |
|
public 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 |
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