Top Description Inners Fields Constructors Methods
org.hibernate.engine.internal

public Class EntityEntryContext

extends Object
Class Inheritance
Imports
org.hibernate.HibernateException, .LockMode, org.hibernate.boot.registry.classloading.spi.ClassLoaderService, org.hibernate.engine.internal.ManagedTypeHelper, org.hibernate.engine.spi.EntityEntry, .ManagedEntity, .PersistenceContext, org.hibernate.internal.CoreLogging, .CoreMessageLogger, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, java.lang.reflect.InvocationTargetException, .Method, java.util.IdentityHashMap, .Map

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:

Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
private static class
EntityEntryContext.EntityEntryCrossRefImpl

Implementation of the EntityEntryCrossRef interface

private static class
private static class
EntityEntryContext.ManagedEntityImpl

The wrapper for entity classes which do not implement ManagedEntity

Field Summary

Modifier and TypeField and Description
private transient int
private transient boolean
private transient ManagedEntity
private transient IdentityHashMap<ManagedEntity, EntityEntryContext.ImmutableManagedEntityHolder>
private static final CoreMessageLogger
private transient IdentityHashMap<Object, ManagedEntity>
private transient PersistenceContext
private transient Map.Entry<Object, EntityEntry>[]
private transient ManagedEntity

Constructor Summary

AccessConstructor and Description
public
EntityEntryContext(PersistenceContext persistenceContext)

Constructs a EntityEntryContext

Method Summary

Modifier and TypeMethod and Description
public void
addEntityEntry(Object
The entity
entity
,
EntityEntry
The entry
entityEntry
)

Adds the entity and entry to this context, associating them together

private void
public void
clear()

Clear this context of all managed entities

public static EntityEntryContext

Returns:

The deserialized EntityEntryContext
deserialize
(ObjectInputStream
The stream to read ourselves from
ois
,
StatefulPersistenceContext
The persistence context we belong to
rtn
)

JDK serialization hook for deserializing

private static EntityEntry
deserializeEntityEntry(char[] entityEntryClassNameArr, ObjectInputStream ois, StatefulPersistenceContext rtn)

public void
downgradeLocks()

Down-grade locks to NONE for all entities in this context

private ManagedEntity
public EntityEntry

Returns:

The associated EntityEntry
getEntityEntry
(Object
The entity to retrieve the EntityEntry for
entity
)

Retrieve the associated EntityEntry for the entity

public int
public boolean

Returns:

true if it is associated with this context
hasEntityEntry
(Object
The entity to check
entity
)

Does this entity exist in this context, associated with an EntityEntry?

public Map.Entry<Object, EntityEntry>[]

Returns:

The safe array
reentrantSafeEntityEntries
()

The main bugaboo with IdentityMap that warranted this class in the first place.

public EntityEntry

Returns:

Tjee EntityEntry
removeEntityEntry
(Object
The entity to remove
entity
)

Remove an entity from the context, returning the EntityEntry which was associated with it

public void
serialize(ObjectOutputStream
The stream to write ourselves to
oos
)

JDK serialization hook for serializing

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
private transient int count
dirtyback to summary
private transient boolean dirty
immutableManagedEntityXrefback to summary
private transient IdentityHashMap<ManagedEntity, EntityEntryContext.ImmutableManagedEntityHolder> immutableManagedEntityXref
logback to summary
private static final CoreMessageLogger log
nonEnhancedEntityXrefback to summary
private transient IdentityHashMap<Object, ManagedEntity> nonEnhancedEntityXref
persistenceContextback to summary
private transient PersistenceContext persistenceContext
reentrantSafeEntriesback to summary
private transient Map.Entry<Object, EntityEntry>[] reentrantSafeEntries
Annotations
@SuppressWarnings:unchecked
tailback to summary
private transient ManagedEntity tail

Constructor Detail

EntityEntryContextback to summary
public EntityEntryContext(PersistenceContext persistenceContext)

Constructs a EntityEntryContext

Method Detail

addEntityEntryback to summary
public void addEntityEntry(Object entity, EntityEntry entityEntry)

Adds the entity and entry to this context, associating them together

Parameters
entity:Object

The entity

entityEntry:EntityEntry

The entry

checkNotAssociatedWithOtherPersistenceContextIfMutableback to summary
private void checkNotAssociatedWithOtherPersistenceContextIfMutable(ManagedEntity managedEntity)
clearback to summary
public void clear()

Clear this context of all managed entities

deserializeback to summary
public static EntityEntryContext deserialize(ObjectInputStream ois, StatefulPersistenceContext rtn) throws IOException, ClassNotFoundException

JDK serialization hook for deserializing

Parameters
ois:ObjectInputStream

The stream to read ourselves from

rtn:StatefulPersistenceContext

The persistence context we belong to

Returns:EntityEntryContext

The deserialized EntityEntryContext

Exceptions
IOException:
Indicates an IO exception accessing the given stream
ClassNotFoundException:
Problem reading stream data
deserializeEntityEntryback to summary
private static EntityEntry deserializeEntityEntry(char[] entityEntryClassNameArr, ObjectInputStream ois, StatefulPersistenceContext rtn)
downgradeLocksback to summary
public void downgradeLocks()

Down-grade locks to NONE for all entities in this context

getAssociatedManagedEntityback to summary
private ManagedEntity getAssociatedManagedEntity(Object entity)
getEntityEntryback to summary
public EntityEntry getEntityEntry(Object entity)

Retrieve the associated EntityEntry for the entity

Parameters
entity:Object

The entity to retrieve the EntityEntry for

Returns:EntityEntry

The associated EntityEntry

getNumberOfManagedEntitiesback to summary
public int getNumberOfManagedEntities()
hasEntityEntryback to summary
public boolean hasEntityEntry(Object entity)

Does this entity exist in this context, associated with an EntityEntry?

Parameters
entity:Object

The entity to check

Returns:boolean

true if it is associated with this context

reentrantSafeEntityEntriesback to summary
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

Returns:Map.Entry<Object, EntityEntry>[]

The safe array

removeEntityEntryback to summary
public EntityEntry removeEntityEntry(Object entity)

Remove an entity from the context, returning the EntityEntry which was associated with it

Parameters
entity:Object

The entity to remove

Returns:EntityEntry

Tjee EntityEntry

serializeback to summary
public void serialize(ObjectOutputStream oos) throws IOException

JDK serialization hook for serializing

Parameters
oos:ObjectOutputStream

The stream to write ourselves to

Exceptions
IOException:
Indicates an IO exception accessing the given stream
org.hibernate.engine.internal back to summary

public Interface EntityEntryContext.EntityEntryCrossRef

extends Map.Entry<Object, EntityEntry>
Known Direct Implementers
org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRefImpl

Used in building the reentrantSafeEntityEntries() entries

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

The entity
getEntity
()

The entity

public EntityEntry

Returns:

The EntityEntry associated with the entity in this context
getEntityEntry
()

The associated EntityEntry

Inherited from java.util.Map.Entry:
comparingByKeycomparingByKeycomparingByValuecomparingByValuecopyOfequalsgetKeygetValuehashCodesetValue

Method Detail

getEntityback to summary
public Object getEntity()

The entity

Returns:Object

The entity

getEntityEntryback to summary
public EntityEntry getEntityEntry()

The associated EntityEntry

Returns:EntityEntry

The EntityEntry associated with the entity in this context

org.hibernate.engine.internal back to summary

private Class EntityEntryContext.EntityEntryCrossRefImpl

extends Object
implements EntityEntryCrossRef
Class Inheritance
  • java.lang.Object
  • org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRefImpl
All Implemented Interfaces
org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRef, java.util.Map.Entry

Implementation of the EntityEntryCrossRef interface

Field Summary

Modifier and TypeField and Description
private final Object
private EntityEntry

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Object
public EntityEntry
public Object
getKey()

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.
public EntityEntry
getValue()

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public EntityEntry
setValue(EntityEntry
new value to be stored in this entry
entityEntry
)

Implements java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entityback to summary
private final Object entity
entityEntryback to summary
private EntityEntry entityEntry

Constructor Detail

EntityEntryCrossRefImplback to summary
private EntityEntryCrossRefImpl(Object entity, EntityEntry entityEntry)

Method Detail

getEntityback to summary
public Object getEntity()

Implements org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRef.getEntity.

Doc from org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRef.getEntity.

The entity

Returns:Object

The entity

Annotations
@Override
getEntityEntryback to summary
public EntityEntry getEntityEntry()

Implements org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRef.getEntityEntry.

Doc from org.hibernate.engine.internal.EntityEntryContext.EntityEntryCrossRef.getEntityEntry.

The associated EntityEntry

Returns:EntityEntry

The EntityEntry associated with the entity in this context

Annotations
@Override
getKeyback to summary
public Object getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:Object

the key corresponding to this entry

Annotations
@Override
getValueback to summary
public EntityEntry getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:EntityEntry

the value corresponding to this entry

Annotations
@Override
setValueback to summary
public EntityEntry setValue(EntityEntry entityEntry)

Implements java.util.Map.Entry.setValue.

Doc from java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).

Parameters
entityEntry:EntityEntry

new value to be stored in this entry

Returns:EntityEntry

old value corresponding to the entry

Annotations
@Override
org.hibernate.engine.internal back to summary

private Class EntityEntryContext.ImmutableManagedEntityHolder

extends Object
implements ManagedEntity
Class Inheritance
  • java.lang.Object
  • org.hibernate.engine.internal.EntityEntryContext.ImmutableManagedEntityHolder
All Implemented Interfaces
org.hibernate.engine.spi.ManagedEntity, org.hibernate.engine.spi.Managed

Field Summary

Modifier and TypeField and Description
private ManagedEntity
private ManagedEntity
private ManagedEntity

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public EntityEntry
$$_hibernate_getEntityEntry()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityEntry.

Provides access to the associated EntityEntry.
public Object
public ManagedEntity
$$_hibernate_getNextManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getNextManagedEntity.

Part of entry linking; obtain reference to the next entry.
public ManagedEntity
$$_hibernate_getPreviousManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getPreviousManagedEntity.

Part of entry linking; obtain reference to the previous entry.
public void
$$_hibernate_setEntityEntry(EntityEntry
The EntityEntry associated with this entity instance.
entityEntry
)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setEntityEntry.

Injects the EntityEntry associated with this entity instance.
public void
public void
$$_hibernate_setPreviousManagedEntity(ManagedEntity
The previous entry
previous
)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setPreviousManagedEntity.

Part of entry linking; sets the previous entry.
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

managedEntityback to summary
private ManagedEntity managedEntity
nextback to summary
private ManagedEntity next
previousback to summary
private ManagedEntity previous

Constructor Detail

ImmutableManagedEntityHolderback to summary
public ImmutableManagedEntityHolder(ManagedEntity immutableManagedEntity)

Method Detail

$$_hibernate_getEntityEntryback to summary
public EntityEntry $$_hibernate_getEntityEntry()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityEntry.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityEntry.

Provides access to the associated EntityEntry.

Returns:EntityEntry

The EntityEntry associated with this entity instance.

Annotations
@Override
$$_hibernate_getEntityInstanceback to summary
public Object $$_hibernate_getEntityInstance()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityInstance.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityInstance.

Obtain a reference to the entity instance.

Returns:Object

The entity instance.

Annotations
@Override
$$_hibernate_getNextManagedEntityback to summary
public ManagedEntity $$_hibernate_getNextManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getNextManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getNextManagedEntity.

Part of entry linking; obtain reference to the next entry. Can be null, which should indicate this is the tail node.

Returns:ManagedEntity

The next entry

Annotations
@Override
$$_hibernate_getPreviousManagedEntityback to summary
public ManagedEntity $$_hibernate_getPreviousManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getPreviousManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getPreviousManagedEntity.

Part of entry linking; obtain reference to the previous entry. Can be null, which should indicate this is the head node.

Returns:ManagedEntity

The previous entry

Annotations
@Override
$$_hibernate_setEntityEntryback to summary
public void $$_hibernate_setEntityEntry(EntityEntry entityEntry)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setEntityEntry.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setEntityEntry.

Injects the EntityEntry associated with this entity instance. The EntityEntry represents state associated with the entity in regards to its association with a Hibernate Session.

Parameters
entityEntry:EntityEntry

The EntityEntry associated with this entity instance.

Annotations
@Override
$$_hibernate_setNextManagedEntityback to summary
public void $$_hibernate_setNextManagedEntity(ManagedEntity next)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setNextManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setNextManagedEntity.

Part of entry linking; sets the next entry. Again, can be null, which should indicate this is (now) the tail node.

Parameters
next:ManagedEntity

The next entry

Annotations
@Override
$$_hibernate_setPreviousManagedEntityback to summary
public void $$_hibernate_setPreviousManagedEntity(ManagedEntity previous)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setPreviousManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setPreviousManagedEntity.

Part of entry linking; sets the previous entry. Again, can be null, which should indicate this is (now) the head node.

Parameters
previous:ManagedEntity

The previous entry

Annotations
@Override
canClearEntityEntryReferenceback to summary
private boolean canClearEntityEntryReference()
org.hibernate.engine.internal back to summary

private Class EntityEntryContext.ManagedEntityImpl

extends Object
implements ManagedEntity
Class Inheritance
  • java.lang.Object
  • org.hibernate.engine.internal.EntityEntryContext.ManagedEntityImpl
All Implemented Interfaces
org.hibernate.engine.spi.ManagedEntity, org.hibernate.engine.spi.Managed

The wrapper for entity classes which do not implement ManagedEntity

Field Summary

Modifier and TypeField and Description
private EntityEntry
private final Object
private ManagedEntity
private ManagedEntity

Constructor Summary

AccessConstructor and Description
public
ManagedEntityImpl(Object entityInstance)

Method Summary

Modifier and TypeMethod and Description
public EntityEntry
$$_hibernate_getEntityEntry()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityEntry.

Provides access to the associated EntityEntry.
public Object
public ManagedEntity
$$_hibernate_getNextManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getNextManagedEntity.

Part of entry linking; obtain reference to the next entry.
public ManagedEntity
$$_hibernate_getPreviousManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getPreviousManagedEntity.

Part of entry linking; obtain reference to the previous entry.
public void
$$_hibernate_setEntityEntry(EntityEntry
The EntityEntry associated with this entity instance.
entityEntry
)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setEntityEntry.

Injects the EntityEntry associated with this entity instance.
public void
public void
$$_hibernate_setPreviousManagedEntity(ManagedEntity
The previous entry
previous
)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setPreviousManagedEntity.

Part of entry linking; sets the previous entry.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entityEntryback to summary
private EntityEntry entityEntry
entityInstanceback to summary
private final Object entityInstance
nextback to summary
private ManagedEntity next
previousback to summary
private ManagedEntity previous

Constructor Detail

ManagedEntityImplback to summary
public ManagedEntityImpl(Object entityInstance)

Method Detail

$$_hibernate_getEntityEntryback to summary
public EntityEntry $$_hibernate_getEntityEntry()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityEntry.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityEntry.

Provides access to the associated EntityEntry.

Returns:EntityEntry

The EntityEntry associated with this entity instance.

Annotations
@Override
$$_hibernate_getEntityInstanceback to summary
public Object $$_hibernate_getEntityInstance()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityInstance.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getEntityInstance.

Obtain a reference to the entity instance.

Returns:Object

The entity instance.

Annotations
@Override
$$_hibernate_getNextManagedEntityback to summary
public ManagedEntity $$_hibernate_getNextManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getNextManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getNextManagedEntity.

Part of entry linking; obtain reference to the next entry. Can be null, which should indicate this is the tail node.

Returns:ManagedEntity

The next entry

Annotations
@Override
$$_hibernate_getPreviousManagedEntityback to summary
public ManagedEntity $$_hibernate_getPreviousManagedEntity()

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getPreviousManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_getPreviousManagedEntity.

Part of entry linking; obtain reference to the previous entry. Can be null, which should indicate this is the head node.

Returns:ManagedEntity

The previous entry

Annotations
@Override
$$_hibernate_setEntityEntryback to summary
public void $$_hibernate_setEntityEntry(EntityEntry entityEntry)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setEntityEntry.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setEntityEntry.

Injects the EntityEntry associated with this entity instance. The EntityEntry represents state associated with the entity in regards to its association with a Hibernate Session.

Parameters
entityEntry:EntityEntry

The EntityEntry associated with this entity instance.

Annotations
@Override
$$_hibernate_setNextManagedEntityback to summary
public void $$_hibernate_setNextManagedEntity(ManagedEntity next)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setNextManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setNextManagedEntity.

Part of entry linking; sets the next entry. Again, can be null, which should indicate this is (now) the tail node.

Parameters
next:ManagedEntity

The next entry

Annotations
@Override
$$_hibernate_setPreviousManagedEntityback to summary
public void $$_hibernate_setPreviousManagedEntity(ManagedEntity previous)

Implements org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setPreviousManagedEntity.

Doc from org.hibernate.engine.spi.ManagedEntity.$$_hibernate_setPreviousManagedEntity.

Part of entry linking; sets the previous entry. Again, can be null, which should indicate this is (now) the head node.

Parameters
previous:ManagedEntity

The previous entry

Annotations
@Override