public class SessionImpl extends Object
| Constructor and Description |
|---|
SessionImpl(EntityManagerImpl entityManager,
MetamodelImpl metamodel) |
| Modifier and Type | Method and Description |
|---|---|
void |
cascadeRemovals()
Cascades the removals.
|
void |
checkTransient(Object instance)
Checks if the instance is managed in this session
|
void |
clear()
Clears the session.
|
void |
flush(ConnectionImpl 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.
|
int |
getSessionId()
Returns the sessionId.
|
void |
handleAdditions()
Handles the additions to the collections.
|
void |
handleExternals()
Handles the external entities that are updated
|
void |
handleOrphans()
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.
|
public SessionImpl(EntityManagerImpl entityManager, MetamodelImpl metamodel)
entityManager - the owner entity managermetamodel - the metamodelpublic void cascadeRemovals()
public void checkTransient(Object instance)
instance - the instance to checkpublic void clear()
public void flush(ConnectionImpl 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 int getSessionId()
public void handleAdditions()
public void handleExternals()
public void handleOrphans()
public 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 Batoo Software & Consultancy. All Rights Reserved.