类 EntityEntryContext
- java.lang.Object
-
- org.hibernate.engine.internal.EntityEntryContext
-
public class EntityEntryContext extends Object
Defines a context for maintaining the relation between an entity associated with the Session ultimately owning this EntityEntryContext instance and that entity's corresponding EntityEntry. 2 approaches are supported:- the entity->EntityEntry association is maintained in a Map within this class
-
the EntityEntry is injected into the entity via it implementing the
ManagedEntitycontract, either directly or through bytecode enhancement.
- 作者:
- Steve Ebersole
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interfaceEntityEntryContext.EntityEntryCrossRefUsed in building thereentrantSafeEntityEntries()entries
-
构造器概要
构造器 构造器 说明 EntityEntryContext(PersistenceContext persistenceContext)Constructs a EntityEntryContext
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddEntityEntry(Object entity, EntityEntry entityEntry)Adds the entity and entry to this context, associating them togethervoidclear()Clear this context of all managed entitiesstatic EntityEntryContextdeserialize(ObjectInputStream ois, StatefulPersistenceContext rtn)JDK serialization hook for deserializingvoiddowngradeLocks()Down-grade locks to NONE for all entities in this contextEntityEntrygetEntityEntry(Object entity)Retrieve the associated EntityEntry for the entityintgetNumberOfManagedEntities()booleanhasEntityEntry(Object entity)Does this entity exist in this context, associated with an EntityEntry?Map.Entry<Object,EntityEntry>[]reentrantSafeEntityEntries()The main bugaboo with IdentityMap that warranted this class in the first place.EntityEntryremoveEntityEntry(Object entity)Remove an entity from the context, returning the EntityEntry which was associated with itvoidserialize(ObjectOutputStream oos)JDK serialization hook for serializing
-
-
-
构造器详细资料
-
EntityEntryContext
public EntityEntryContext(PersistenceContext persistenceContext)
Constructs a EntityEntryContext
-
-
方法详细资料
-
addEntityEntry
public void addEntityEntry(Object entity, EntityEntry entityEntry)
Adds the entity and entry to this context, associating them together- 参数:
entity- The entityentityEntry- The entry
-
hasEntityEntry
public boolean hasEntityEntry(Object entity)
Does this entity exist in this context, associated with an EntityEntry?- 参数:
entity- The entity to check- 返回:
trueif it is associated with this context
-
getEntityEntry
public EntityEntry getEntityEntry(Object entity)
Retrieve the associated EntityEntry for the entity- 参数:
entity- The entity to retrieve the EntityEntry for- 返回:
- The associated EntityEntry
-
removeEntityEntry
public EntityEntry removeEntityEntry(Object entity)
Remove an entity from the context, returning the EntityEntry which was associated with it- 参数:
entity- The entity to remove- 返回:
- Tjee EntityEntry
-
reentrantSafeEntityEntries
public Map.Entry<Object,EntityEntry>[] reentrantSafeEntityEntries()
The main bugaboo with IdentityMap that warranted this class in the first place. Return an array of all the entity/EntityEntry pairs in this context. The array is to make sure that the iterators built off of it are safe from concurrency/reentrancy- 返回:
- The safe array
-
clear
public void clear()
Clear this context of all managed entities
-
downgradeLocks
public void downgradeLocks()
Down-grade locks to NONE for all entities in this context
-
serialize
public void serialize(ObjectOutputStream oos) throws IOException
JDK serialization hook for serializing- 参数:
oos- The stream to write ourselves to- 抛出:
IOException- Indicates an IO exception accessing the given stream
-
deserialize
public static EntityEntryContext deserialize(ObjectInputStream ois, StatefulPersistenceContext rtn) throws IOException, ClassNotFoundException
JDK serialization hook for deserializing- 参数:
ois- The stream to read ourselves fromrtn- The persistence context we belong to- 返回:
- The deserialized EntityEntryContext
- 抛出:
IOException- Indicates an IO exception accessing the given streamClassNotFoundException- Problem reading stream data
-
getNumberOfManagedEntities
public int getNumberOfManagedEntities()
-
-