@java.lang.SuppressWarnings("rawtypes") public interface Session extends QueryCreator
The Session represents the active interaction with a datastore.
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
attach(java.lang.Object o) Attaches an object the current session |
|
public Transaction |
beginTransaction() Starts a transaction |
|
public Transaction |
beginTransaction(org.springframework.transaction.TransactionDefinition definition) Starts a transaction |
|
public void |
clear() Clears any pending changes to the datastore |
|
public void |
clear(java.lang.Object o) Clear a specific object |
|
public java.lang.Object |
clearSessionProperty(java.lang.String property) Clear a property in a session. |
|
public boolean |
contains(java.lang.Object o) Whether the object is contained within the first level cache |
|
public Query |
createQuery(java.lang.Class type) Creates a query instance for the give type |
|
public void |
delete(java.lang.Iterable objects) Deletes one or many objects |
|
public void |
delete(java.lang.Object obj) Deletes a single object |
|
public long |
deleteAll(QueryableCriteria criteria) Deletes all objects matching the given criteria |
|
public void |
disconnect() Disconnects from the datastore. |
|
public void |
flush() Flushes any pending changes to the datastore |
|
public java.lang.Object |
getAttribute(java.lang.Object entity, java.lang.String attributeName) Obtains an attribute for the given entity |
|
public Datastore |
getDatastore() The Datastore that created this Session |
|
public javax.persistence.FlushModeType |
getFlushMode() Obtains the current FlushModeType |
|
public MappingContext |
getMappingContext() Obtains the MappingContext instance |
|
public java.lang.Object |
getNativeInterface()
|
|
public java.io.Serializable |
getObjectIdentifier(java.lang.Object instance) Obtains the identifier for the instance |
|
public Persister |
getPersister(java.lang.Object o) The persister for the given object |
|
public java.lang.Object |
getSessionProperty(java.lang.String property) Get the value of a property of the session. |
|
public Transaction |
getTransaction() Obtains the current transaction instance |
|
public boolean |
hasTransaction()
|
|
public java.io.Serializable |
insert(java.lang.Object o) Forces an insert |
|
public boolean |
isConnected()
|
|
public boolean |
isDirty(java.lang.Object instance) Check if the instance has been modified since loading. |
|
public void |
lock(java.lang.Object o) Obtains a write lock on the given object |
<T> |
public T |
lock(java.lang.Class<T> type, java.io.Serializable key) Retrieves an individual object, using a write lock to prevent loss of updates |
|
public java.io.Serializable |
persist(java.lang.Object o) Stores and object and returns its key |
|
public java.util.List<java.io.Serializable> |
persist(java.lang.Iterable objects) Persists several objects returning their identifiers in the order specified by the Iterable |
<T> |
public T |
proxy(java.lang.Class<T> type, java.io.Serializable key) Retrieves a proxy for the given key |
|
public void |
refresh(java.lang.Object o) Refreshes the given objects state |
<T> |
public T |
retrieve(java.lang.Class<T> type, java.io.Serializable key) Retrieves an individual object |
|
public java.util.List |
retrieveAll(java.lang.Class type, java.lang.Iterable keys) Retrieves several objects for the specified keys |
|
public java.util.List |
retrieveAll(java.lang.Class type, java.io.Serializable keys) Retrieves several objects for the specified keys |
|
public void |
setAttribute(java.lang.Object entity, java.lang.String attributeName, java.lang.Object value) Associates an attribute with the given persistent entity. |
|
public void |
setFlushMode(javax.persistence.FlushModeType flushMode) The flush mode, defaults to FlushModeType.COMMIT |
|
public java.lang.Object |
setSessionProperty(java.lang.String property, java.lang.Object value) Set a property on this session. |
|
public void |
setSynchronizedWithTransaction(boolean synchronizedWithTransaction) Whether the session is synchronized with a transaction |
|
public void |
unlock(java.lang.Object o) Releases a lock, if not called all locked objects should be released by disconnect() |
|
public long |
updateAll(QueryableCriteria criteria, java.util.Map<java.lang.String, java.lang.Object> properties) Updates all objects matching the given criteria and property values |
Methods inherited from class | Name |
---|---|
interface QueryCreator |
createQuery, isSchemaless |
Attaches an object the current session
o
- The object to attachStarts a transaction
Starts a transaction
Clears any pending changes to the datastore
Clear a specific object
o
- The object to clearClear a property in a session.
property
- The property name.Whether the object is contained within the first level cache
o
- The object to checktrue
if it isCreates a query instance for the give type
type
- The typeDeletes one or many objects
objects
- The objects to deleteDeletes a single object
obj
- The object to deleteDeletes all objects matching the given criteria
criteria
- The criteriaDisconnects from the datastore.
Flushes any pending changes to the datastore
Obtains an attribute for the given entity
entity
- The entityattributeName
- The attributeThe Datastore that created this Session
Obtains the current FlushModeType
Obtains the MappingContext instance
Obtains the identifier for the instance
instance
- The instanceThe persister for the given object
o
- The objectGet the value of a property of the session.
property
- The name of the property.Obtains the current transaction instance
Forces an insert
o
- The object
true
if connected to the datastoreCheck if the instance has been modified since loading.
instance
- the instancetrue
if one or more fields have changedObtains a write lock on the given object
o
- The object to lockRetrieves an individual object, using a write lock to prevent loss of updates
type
- The typekey
- The keyStores and object and returns its key
o
- The objectPersists several objects returning their identifiers in the order specified by the Iterable
objects
- The ObjectsRetrieves a proxy for the given key
type
- The typekey
- The keyRefreshes the given objects state
o
- The object to refreshRetrieves an individual object
type
- The typekey
- The keyRetrieves several objects for the specified keys
type
- The typekeys
- The keysRetrieves several objects for the specified keys
type
- The typekeys
- The keysAssociates an attribute with the given persistent entity. Attributes will be cleared out when the Session is closed or cleared.
entity
- The persistent instance (must be associated with this Session)attributeName
- The attribute namevalue
- The valueThe flush mode, defaults to FlushModeType.COMMIT
flushMode
- The FlushModeTypeSet a property on this session. Note that properties are not cleared out when a session is cleared.
property
- The property name.value
- The property value.Whether the session is synchronized with a transaction
synchronizedWithTransaction
- True if it isReleases a lock, if not called all locked objects should be released by disconnect()
o
- The object to unlockUpdates all objects matching the given criteria and property values
criteria
- The criteriaproperties
- The properties