X - the type of the managed instancepublic class ManagedInstance<X> extends Object
| Modifier and Type | Field and Description |
|---|---|
static ThreadLocal<javax.persistence.LockModeType> |
LOCK_CONTEXT
The current lock mode context.
|
| Constructor and Description |
|---|
ManagedInstance(EntityTypeImpl<X> type,
SessionImpl session,
X instance) |
ManagedInstance(EntityTypeImpl<X> type,
SessionImpl session,
X instance,
ManagedId<? super X> id) |
| Modifier and Type | Method and Description |
|---|---|
void |
cascadeDetach(EntityManagerImpl entityManager)
Cascades the detach operation.
|
boolean |
cascadePersist(EntityManagerImpl entityManager,
ArrayList<Object> processed,
LinkedList<ManagedInstance<?>> instances)
Cascades the persist operation.
|
void |
cascadeRemove(EntityManagerImpl entityManager,
ArrayList<Object> processed,
LinkedList<ManagedInstance<?>> instances)
Cascades the remove operation
|
void |
changed()
Marks the instance as may have changed.
|
void |
checkTransients()
Checks that no association of the instance is transient
|
void |
checkUpdated()
Checks if the instance updated.
|
void |
enhanceCollections()
Enhances the collections of the managed instance.
|
boolean |
equals(Object obj) |
boolean |
fillIdValues()
Fills the sequence / table generated values.
|
void |
fireCallbacks(EntityListenerMetadata.EntityListenerType type)
Fires the callbacks.
|
void |
flushAssociations(Connection connection,
boolean removals,
boolean force)
Flushes the associations.
|
ManagedId<? super X> |
getId()
Returns the id of the instance.
|
X |
getInstance()
Returns the instance.
|
javax.persistence.LockModeType |
getLockMode()
Returns the lock mode of the instance.
|
Object |
getOldVersion()
Returns the old version of the instance.
|
SessionImpl |
getSession()
Returns the session.
|
Status |
getStatus()
Returns the status.
|
EntityTypeImpl<X> |
getType()
Returns the type.
|
void |
handleAdditions(EntityManagerImpl entityManager)
Handles the entities that have been added.
|
void |
handleOrphans(EntityManagerImpl entityManager)
Handles the entities that have been orphaned.
|
int |
hashCode() |
boolean |
hasInitialId()
Returns if the instance has initial id.
|
boolean |
hasSelfUpdate()
Returns if the instance has self update.
|
void |
incrementVersion(Connection connection,
boolean commit)
Increments the version of the instance.
|
boolean |
isJoinLoaded(String attributeName)
Returns if attribute name
attributeNaƶe has been loaded. |
boolean |
isLoading()
Returns if the instance is loading.
|
boolean |
isLoadingFromCache()
Returns if the instance is loading from the cache.
|
boolean |
isRefreshing()
Returns if the instance is refreshing.
|
void |
mergeWith(EntityManagerImpl entityManager,
X entity,
org.apache.commons.lang.mutable.MutableBoolean requiresFlush,
IdentityHashMap<Object,Object> processed,
LinkedList<ManagedInstance<?>> instances)
Merges the instance state with the
entity. |
void |
processJoinedMappings()
Processes the associations.
|
void |
refresh(EntityManagerImpl entityManager,
Connection connection,
javax.persistence.LockModeType lockMode,
Set<Object> processed)
Refreshes the instance from the database.
|
void |
reset()
Resets the change status of the instance.
|
void |
setChanged(PluralMappingEx<?,?,?> association)
Marks the plural association as changed.
|
void |
setJoinLoaded(JoinedMapping<?,?,?> mapping)
Sets the association as loaded.
|
void |
setLoading(boolean loading)
Marks the instance as loading.
|
void |
setLoadingFromCache(boolean loadingFromCache)
Marks the instance as loading loading from the cahce.
|
void |
setRefreshing(boolean refreshing)
Marks the instance as refreshing.
|
void |
setStatus(Status status)
Sets the status.
|
void |
sortLists()
Sorts the list associations.
|
String |
toString() |
public static ThreadLocal<javax.persistence.LockModeType> LOCK_CONTEXT
public ManagedInstance(EntityTypeImpl<X> type, SessionImpl session, X instance)
type - the entity type of the instancesession - the sessioninstance - the instancepublic ManagedInstance(EntityTypeImpl<X> type, SessionImpl session, X instance, ManagedId<? super X> id)
type - the entity type of the instancesession - the sessioninstance - the instanceid - the id of the instancepublic void cascadeDetach(EntityManagerImpl entityManager)
entityManager - the entity managerpublic boolean cascadePersist(EntityManagerImpl entityManager, ArrayList<Object> processed, LinkedList<ManagedInstance<?>> instances)
entityManager - the entity managerprocessed - registry of processed entitiesinstances - the managed instancespublic void cascadeRemove(EntityManagerImpl entityManager, ArrayList<Object> processed, LinkedList<ManagedInstance<?>> instances)
entityManager - the entity managerprocessed - registry of processed entitiesinstances - the managed instancespublic void changed()
public void checkTransients()
public void checkUpdated()
Only meaningful for external entities as their instances' are not enhanced.
public void enhanceCollections()
public boolean fillIdValues()
public void fireCallbacks(EntityListenerMetadata.EntityListenerType type)
type - the type of the callbackspublic void flushAssociations(Connection connection, boolean removals, boolean force) throws SQLException
connection - the connectionremovals - true if the removals should be flushed and false for the additionsforce - true to force, effective only for insertions and for new entities.SQLException - thrown if there is an underlying SQL Exceptionpublic ManagedId<? super X> getId()
public X getInstance()
public javax.persistence.LockModeType getLockMode()
public Object getOldVersion()
public SessionImpl getSession()
public Status getStatus()
public EntityTypeImpl<X> getType()
public void handleAdditions(EntityManagerImpl entityManager)
entityManager - the entity managerpublic void handleOrphans(EntityManagerImpl entityManager)
entityManager - the entity managerpublic boolean hasInitialId()
public boolean hasSelfUpdate()
public void incrementVersion(Connection connection, boolean commit) throws SQLException
connection - the connectioncommit - true if version update should be committed immediatelySQLException - thrown in case of an underlying SQL errorpublic boolean isJoinLoaded(String attributeName)
attributeNaƶe has been loaded.attributeName - the name of the attributepublic boolean isLoading()
public boolean isLoadingFromCache()
public boolean isRefreshing()
public void mergeWith(EntityManagerImpl entityManager, X entity, org.apache.commons.lang.mutable.MutableBoolean requiresFlush, IdentityHashMap<Object,Object> processed, LinkedList<ManagedInstance<?>> instances)
entity.entityManager - the entity managerentity - the entity to mergerequiresFlush - if an implicit flush is requiredprocessed - registry of processed entitiesinstances - the persisted instancespublic void processJoinedMappings()
public void refresh(EntityManagerImpl entityManager, Connection connection, javax.persistence.LockModeType lockMode, Set<Object> processed)
entityManager - the entity managerconnection - the connectionlockMode - the lock modeprocessed - the set of processed instancespublic void reset()
public void setChanged(PluralMappingEx<?,?,?> association)
association - the association that has changedpublic void setJoinLoaded(JoinedMapping<?,?,?> mapping)
mapping - the associationpublic void setLoading(boolean loading)
loading - loading to setpublic void setLoadingFromCache(boolean loadingFromCache)
loadingFromCache - loading to setpublic void setRefreshing(boolean refreshing)
refreshing - refreshing to setpublic void setStatus(Status status)
status - the status to setpublic void sortLists()
Copyright © 2012-2013 Batoo. All Rights Reserved.