public class SessionImpl extends Object
| Constructor and Description |
|---|
SessionImpl(EntityManagerImpl entityManager,
MetamodelImpl metamodel) |
| Modifier and Type | Method and Description |
|---|---|
void |
cascadeRemovals(ManagedInstance<?>[] instances)
Cascades the removals.
|
void |
checkTransient(Object instance)
Checks if the instance is managed in this session
|
void |
clear()
Clears the session.
|
void |
flush(Connection connection)
Flushes the session persisting changes to the database.
|
<Y,X> ManagedInstance<Y> |
get(ManagedId<X> id)
Returns the managed instance instance in the session
|
<X> ManagedInstance<X> |
get(X entity)
Returns the managed instance instance in the session
|
EntityManagerImpl |
getEntityManager()
Returns the entity manager.
|
ManagedInstance<?>[] |
handleAdditions()
Handles the additions to the collections.
|
void |
handleExternals()
Handles the external entities that are updated
|
void |
handleOrphans(ManagedInstance<?>[] instances)
Removes entities that have been orphaned
|
void |
lazyInstanceLoading(ManagedInstance<?> instance)
Notifies the session that the lazy instance is loading
|
<X> void |
put(ManagedInstance<X> instance)
Puts the instance into the session.
|
<X> void |
putExternal(ManagedInstance<X> instance)
Puts the new instance into the session.
|
void |
releaseLoadTracker()
Releases the load tracker, so that the entities loaded are processed for associations and
PostLoad listeners are
invoked. |
ManagedInstance<?> |
remove(Object entity)
Removes the instance from the session.
|
void |
setChanged(ManagedInstance<?> instance)
Marks the instance as changed.
|
void |
setLoadTracker()
Sets the load tracker so that the insertions into session is tracked.
|
String |
toString() |
public SessionImpl(EntityManagerImpl entityManager, MetamodelImpl metamodel)
entityManager - the owner entity managermetamodel - the metamodelpublic void cascadeRemovals(ManagedInstance<?>[] instances)
instances - array of changed instancespublic void checkTransient(Object instance)
instance - the instance to checkpublic void clear()
public void flush(Connection connection) throws SQLException
connection - the connection to useSQLException - thrown in case of an SQL errorpublic <Y,X> ManagedInstance<Y> get(ManagedId<X> id)
X - the type of the instanceY - the actual type of the instanceid - the managed idpublic <X> ManagedInstance<X> get(X entity)
X - the type of the instanceentity - the entitypublic EntityManagerImpl getEntityManager()
public ManagedInstance<?>[] handleAdditions()
public void handleExternals()
public void handleOrphans(ManagedInstance<?>[] instances)
instances - the array of changed instancespublic void lazyInstanceLoading(ManagedInstance<?> instance)
instance - the instancepublic <X> void put(ManagedInstance<X> instance)
X - the type of the instanceinstance - the instance to put into the sessionpublic <X> void putExternal(ManagedInstance<X> instance)
Additionally stores object in a safe repository that it knows the changes are not traced by enhancement.
X - the type of the instanceinstance - the instance to put into the sessionpublic void releaseLoadTracker()
PostLoad listeners are
invoked.public ManagedInstance<?> remove(Object entity)
entity - the entity to removepublic void setChanged(ManagedInstance<?> instance)
instance - the instancepublic void setLoadTracker()
Copyright © 2012-2013 Batoo. All Rights Reserved.