Top Description Methods
org.hibernate.engine

public Interface PersistenceContext

Known Direct Implementers
org.hibernate.engine.StatefulPersistenceContext
Imports
java.io.Serializable, java.util.HashSet, .Map, org.hibernate.HibernateException, .LockMode, .MappingException, org.hibernate.engine.loading.LoadContexts, org.hibernate.collection.PersistentCollection, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister

Holds the state of the persistence context, including the first-level cache, entries, snapshots, proxies, etc.
Author
Gavin King

Method Summary

Modifier and TypeMethod and Description
public void
addChildParent(Object parent, Object child)

Put child/parent relation to cache for cascading op

public void
addCollectionHolder(PersistentCollection holder)

Register a PersistentCollection object for an array.

public void
addEntity(EntityKey key, Object entity)

Add a canonical mapping from entity key to entity instance

public void
addEntity(EntityUniqueKey euk, Object entity)

Add an entity to the cache by unique key

public EntityEntry
addEntity(final Object entity, final Status status, final Object[] loadedState, final EntityKey entityKey, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final boolean disableVersionIncrement, boolean lazyPropertiesAreUnfetched)

Adds an entity to the internal caches.

public EntityEntry
addEntry(final Object entity, final Status status, final Object[] loadedState, final Object rowId, final Serializable id, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final boolean disableVersionIncrement, boolean lazyPropertiesAreUnfetched)

Generates an appropriate EntityEntry instance and adds it to the event source's internal caches.

public CollectionEntry
addInitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)

add a collection we just pulled out of the cache (does not need initializing)

public void
addInitializedDetachedCollection(CollectionPersister collectionPersister, PersistentCollection collection)

add an (initialized) collection that was created by another session and passed into update() (ie.

public void
addNewCollection(CollectionPersister persister, PersistentCollection
The collection to be associated with the persistence context
collection
)

Add a new collection (ie.

public void
addNonLazyCollection(PersistentCollection collection)

Register a collection for non-lazy loading at the end of the two-phase load

public void
addNullProperty(EntityKey ownerKey, String propertyName)

Record the fact that the association belonging to the keyed entity is null.

public void
addProxy(EntityKey key, Object proxy)

Add a proxy to the session cache

public void
addUninitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)

add a collection we just loaded up (still needs initializing)

public void
addUninitializedDetachedCollection(CollectionPersister persister, PersistentCollection collection)

add a detached uninitialized collection

public void
addUnownedCollection(CollectionKey key, PersistentCollection collection)

Add a collection which has no owner loaded

public void
afterLoad()

Call this after finishing a two-phase load

public void
afterTransactionCompletion()

Called after transactions end

public void
beforeLoad()

Call this before beginning a two-phase load

public void
checkUniqueness(EntityKey key, Object
The entity reference against which to perform the uniqueness check.
object
)

Attempts to check whether the given key represents an entity already loaded within the current session.

public void
clear()

Clear the state of the persistence context

public boolean
containsCollection(PersistentCollection collection)

Is the given collection associated with this persistence context?

public boolean
containsEntity(EntityKey key)

Is there an entity with the given key in the persistence context

public boolean
containsProxy(Object proxy)

Is the given proxy associated with this persistence context?

public int
decrementCascadeLevel()

Called after cascading

public BatchFetchQueue
getBatchFetchQueue()

Get the BatchFetchQueue, instantiating one if necessary.

public Object[]
public int
getCascadeLevel()

How deep are we cascaded?

public PersistentCollection
getCollection(CollectionKey collectionKey)

Get the collection instance associated with the CollectionKey

public Map<K, V>
getCollectionEntries()

Get the mapping from collection instance to collection entry

public CollectionEntry
getCollectionEntry(PersistentCollection coll)

Get the collection entry for a persistent collection

public CollectionEntry
getCollectionEntryOrNull(Object collection)

Get the collection entry for a collection passed to filter, which might be a collection wrapper, an array, or an unwrapped collection.

public PersistentCollection
getCollectionHolder(Object array)

Get the PersistentCollection object for an array

public Object
getCollectionOwner(Serializable key, CollectionPersister collectionPersister)

Get the entity that owns this persistent collection

public Map<K, V>
getCollectionsByKey()

Get the mapping from collection key to collection instance

public Object[]
getDatabaseSnapshot(Serializable id, EntityPersister persister)

Get the current state of the entity as known to the underlying database, or null if there is no corresponding row

public Map<K, V>
getEntitiesByKey()

Get the mapping from key value to entity instance

public Object
getEntity(EntityKey key)

Get the entity instance associated with the given EntityKey

public Object
getEntity(EntityUniqueKey euk)

Get an entity cached by unique key

public Map<K, V>
getEntityEntries()

Get the mapping from entity instance to entity entry

public EntityEntry

Returns:

The EntityEntry for the given entity.
getEntry
(Object
The entity for which to locate the EntityEntry.
entity
)

Retrieve the EntityEntry representation of the given entity.

public Object
getIndexInOwner(String entity, String property, Object childObject, Map<K, V> mergeMap)

Search the persistence context for an index of the child object, given a collection role

public LoadContexts

Returns:

The load context
getLoadContexts
()

Retrieve this persistence context's managed load context.

public Serializable

Returns:

the owner ID if available from the collection's loaded key; otherwise, returns null
getLoadedCollectionOwnerIdOrNull
(PersistentCollection
The persistent collection
collection
)

Get the ID for the entity that owned this persistent collection when it was loaded

public Object

Returns:

the owner if its entity ID is available from the collection's loaded key and the owner entity is in the persistence context; otherwise, returns null
getLoadedCollectionOwnerOrNull
(PersistentCollection
The persistent collection
collection
)

Get the entity that owned this persistent collection when it was loaded

public Object[]
getNaturalIdSnapshot(Serializable id, EntityPersister persister)

Get the values of the natural id fields as known to the underlying database, or null if the entity has no natural id or there is no corresponding row.

public HashSet<E>
getNullifiableEntityKeys()

Retrieve the set of EntityKeys representing nullifiable references

public Serializable
getOwnerId(String entity, String property, Object childObject, Map<K, V> mergeMap)

Search the persistence context for an owner for the child object, given a collection role

public Object
getProxy(EntityKey key)

Get an existing proxy by key

public SessionImplementor

Returns:

The session.
getSession
()

Get the session to which this persistence context is bound.

public Serializable
getSnapshot(PersistentCollection coll)

Get the snapshot of the pre-flush collection state

public boolean

Returns:

false if we know for certain that all the entities are read-only
hasNonReadOnlyEntities
()

public int
incrementCascadeLevel()

Called before cascading

public void
initializeNonLazyCollections()

Force initialization of all non-lazy collections encountered during the current two-phase load (actually, this is a no-op, unless this is the "outermost" load)

public boolean

Returns:

true, loaded entities/proxies will be made read-only by default; false, loaded entities/proxies will be made modifiable by default.
isDefaultReadOnly
()

Will entities and proxies that are loaded into this persistence context be made read-only by default?

public boolean
isEntryFor(Object entity)

Is there an EntityEntry for this instance?

public boolean
isFlushing()

Is a flush cycle currently in process?

public boolean
isLoadFinished()

Is in a two-phase load?

public boolean
isPropertyNull(EntityKey ownerKey, String propertyName)

Is the association property belonging to the keyed entity null?

public boolean

Returns:

true, the object is read-only; false, the object is modifiable.
isReadOnly
(Object entityOrProxy)

Is the entity or proxy read-only?

public boolean
public Object

Returns:

An appropriately narrowed instance.
narrowProxy
(Object
The proxy instance to be narrowed.
proxy
,
EntityPersister
The persister for the proxied entity.
persister
,
EntityKey
The internal cache key for the proxied entity.
key
,
Object
(optional) the actual proxied entity instance.
object
)

If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy and overwrite the registration of the old one.

public Object
proxyFor(EntityPersister persister, EntityKey key, Object impl)

Return the existing proxy associated with the given EntityKey, or the third argument (the entity associated with the key) if no proxy exists.

public Object
proxyFor(Object impl)

Return the existing proxy associated with the given EntityKey, or the argument (the entity associated with the key) if no proxy exists.

public boolean

Returns:

Whether the passed value represented an actual proxy which got initialized.
reassociateIfUninitializedProxy
(Object
The possible proxy to be reassociated.
value
)

Takes the given object and, if it represents a proxy, reassociates it with this event source.

public void
reassociateProxy(Object value, Serializable id)

If a deleted entity instance is re-saved, and it has a proxy, we need to reset the identifier of the proxy

public void
registerInsertedKey(EntityPersister
The entity persister
persister
,
Serializable
The id
id
)

Register keys inserted during the current transaction

public void
removeChildParent(Object child)

Remove child/parent relation from cache

public PersistentCollection
removeCollectionHolder(Object array)

Remove the mapping of collection to holder during eviction of the owning entity

public Object
removeEntity(EntityKey key)

Remove an entity from the session cache, also clear up other state associated with the entity, all except for the EntityEntry

public EntityEntry
removeEntry(Object entity)

Remove an entity entry from the session cache

public Object
removeProxy(EntityKey key)

Remove a proxy from the session cache

public void
public void
setDefaultReadOnly(boolean
true, the default for loaded entities/proxies is read-only; false, the default for loaded entities/proxies is modifiable
readOnly
)

Change the default for entities and proxies loaded into this persistence context from modifiable to read-only mode, or from modifiable to read-only mode.

public void
setEntryStatus(EntityEntry entry, Status status)

Set the status of an entry

public void
setFlushing(boolean flushing)

Called before and after the flushcycle

public void
setReadOnly(Object
an entity or HibernateProxy
entityOrProxy
,
boolean
if true, the entity or proxy is made read-only; if false, the entity or proxy is made modifiable.
readOnly
)

Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode.

public String

Returns:

a string representation of the object.
toString
()

Returns a string representation of the object.

public Object
unproxy(Object maybeProxy)

Get the entity instance underlying the given proxy, throwing an exception if the proxy is uninitialized.

public Object

Returns:

The unproxied instance.
unproxyAndReassociate
(Object
The reference to be unproxied if it currently represents a proxy.
maybeProxy
)

Possibly unproxy the given reference and reassociate it with the current session.

public PersistentCollection
useUnownedCollection(CollectionKey key)

Get and remove a collection whose owner is not yet loaded, when its owner is being loaded

public boolean

Returns:

True if inserted during this transaction, false otherwise.
wasInsertedDuringTransaction
(EntityPersister
The entity persister
persister
,
Serializable
The id
id
)

Allows callers to check to see if the identified entity was inserted during the current transaction.

Method Detail

addChildParentback to summary
public void addChildParent(Object parent, Object child)

Put child/parent relation to cache for cascading op

addCollectionHolderback to summary
public void addCollectionHolder(PersistentCollection holder)

Register a PersistentCollection object for an array. Associates a holder with an array - MUST be called after loading array, since the array instance is not created until endLoad().

addEntityback to summary
public void addEntity(EntityKey key, Object entity)

Add a canonical mapping from entity key to entity instance

addEntityback to summary
public void addEntity(EntityUniqueKey euk, Object entity)

Add an entity to the cache by unique key

addEntityback to summary
public EntityEntry addEntity(final Object entity, final Status status, final Object[] loadedState, final EntityKey entityKey, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final boolean disableVersionIncrement, boolean lazyPropertiesAreUnfetched)

Adds an entity to the internal caches.

addEntryback to summary
public EntityEntry addEntry(final Object entity, final Status status, final Object[] loadedState, final Object rowId, final Serializable id, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final boolean disableVersionIncrement, boolean lazyPropertiesAreUnfetched)

Generates an appropriate EntityEntry instance and adds it to the event source's internal caches.

addInitializedCollectionback to summary
public CollectionEntry addInitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id) throws HibernateException

add a collection we just pulled out of the cache (does not need initializing)

addInitializedDetachedCollectionback to summary
public void addInitializedDetachedCollection(CollectionPersister collectionPersister, PersistentCollection collection) throws HibernateException

add an (initialized) collection that was created by another session and passed into update() (ie. one with a snapshot and existing state on the database)

addNewCollectionback to summary
public void addNewCollection(CollectionPersister persister, PersistentCollection collection) throws HibernateException

Add a new collection (ie. a newly created one, just instantiated by the application, with no database state or snapshot)

Parameters
collection:PersistentCollection

The collection to be associated with the persistence context

addNonLazyCollectionback to summary
public void addNonLazyCollection(PersistentCollection collection)

Register a collection for non-lazy loading at the end of the two-phase load

addNullPropertyback to summary
public void addNullProperty(EntityKey ownerKey, String propertyName)

Record the fact that the association belonging to the keyed entity is null.

addProxyback to summary
public void addProxy(EntityKey key, Object proxy)

Add a proxy to the session cache

addUninitializedCollectionback to summary
public void addUninitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)

add a collection we just loaded up (still needs initializing)

addUninitializedDetachedCollectionback to summary
public void addUninitializedDetachedCollection(CollectionPersister persister, PersistentCollection collection)

add a detached uninitialized collection

addUnownedCollectionback to summary
public void addUnownedCollection(CollectionKey key, PersistentCollection collection)

Add a collection which has no owner loaded

afterLoadback to summary
public void afterLoad()

Call this after finishing a two-phase load

afterTransactionCompletionback to summary
public void afterTransactionCompletion()

Called after transactions end

beforeLoadback to summary
public void beforeLoad()

Call this before beginning a two-phase load

checkUniquenessback to summary
public void checkUniqueness(EntityKey key, Object object) throws HibernateException

Attempts to check whether the given key represents an entity already loaded within the current session.

Parameters
object:Object

The entity reference against which to perform the uniqueness check.

clearback to summary
public void clear()

Clear the state of the persistence context

containsCollectionback to summary
public boolean containsCollection(PersistentCollection collection)

Is the given collection associated with this persistence context?

containsEntityback to summary
public boolean containsEntity(EntityKey key)

Is there an entity with the given key in the persistence context

containsProxyback to summary
public boolean containsProxy(Object proxy)

Is the given proxy associated with this persistence context?

decrementCascadeLevelback to summary
public int decrementCascadeLevel()

Called after cascading

getBatchFetchQueueback to summary
public BatchFetchQueue getBatchFetchQueue()

Get the BatchFetchQueue, instantiating one if necessary.

getCachedDatabaseSnapshotback to summary
public Object[] getCachedDatabaseSnapshot(EntityKey key)
getCascadeLevelback to summary
public int getCascadeLevel()

How deep are we cascaded?

getCollectionback to summary
public PersistentCollection getCollection(CollectionKey collectionKey)

Get the collection instance associated with the CollectionKey

getCollectionEntriesback to summary
public Map<K, V> getCollectionEntries()

Get the mapping from collection instance to collection entry

getCollectionEntryback to summary
public CollectionEntry getCollectionEntry(PersistentCollection coll)

Get the collection entry for a persistent collection

getCollectionEntryOrNullback to summary
public CollectionEntry getCollectionEntryOrNull(Object collection)

Get the collection entry for a collection passed to filter, which might be a collection wrapper, an array, or an unwrapped collection. Return null if there is no entry.

getCollectionHolderback to summary
public PersistentCollection getCollectionHolder(Object array)

Get the PersistentCollection object for an array

getCollectionOwnerback to summary
public Object getCollectionOwner(Serializable key, CollectionPersister collectionPersister) throws MappingException

Get the entity that owns this persistent collection

getCollectionsByKeyback to summary
public Map<K, V> getCollectionsByKey()

Get the mapping from collection key to collection instance

getDatabaseSnapshotback to summary
public Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister) throws HibernateException

Get the current state of the entity as known to the underlying database, or null if there is no corresponding row

getEntitiesByKeyback to summary
public Map<K, V> getEntitiesByKey()

Get the mapping from key value to entity instance

getEntityback to summary
public Object getEntity(EntityKey key)

Get the entity instance associated with the given EntityKey

getEntityback to summary
public Object getEntity(EntityUniqueKey euk)

Get an entity cached by unique key

getEntityEntriesback to summary
public Map<K, V> getEntityEntries()

Get the mapping from entity instance to entity entry

getEntryback to summary
public EntityEntry getEntry(Object entity)

Retrieve the EntityEntry representation of the given entity.

Parameters
entity:Object

The entity for which to locate the EntityEntry.

Returns:EntityEntry

The EntityEntry for the given entity.

getIndexInOwnerback to summary
public Object getIndexInOwner(String entity, String property, Object childObject, Map<K, V> mergeMap)

Search the persistence context for an index of the child object, given a collection role

getLoadContextsback to summary
public LoadContexts getLoadContexts()

Retrieve this persistence context's managed load context.

Returns:LoadContexts

The load context

getLoadedCollectionOwnerIdOrNullback to summary
public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection)

Get the ID for the entity that owned this persistent collection when it was loaded

Parameters
collection:PersistentCollection

The persistent collection

Returns:Serializable

the owner ID if available from the collection's loaded key; otherwise, returns null

getLoadedCollectionOwnerOrNullback to summary
public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection)

Get the entity that owned this persistent collection when it was loaded

Parameters
collection:PersistentCollection

The persistent collection

Returns:Object

the owner if its entity ID is available from the collection's loaded key and the owner entity is in the persistence context; otherwise, returns null

getNaturalIdSnapshotback to summary
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister) throws HibernateException

Get the values of the natural id fields as known to the underlying database, or null if the entity has no natural id or there is no corresponding row.

getNullifiableEntityKeysback to summary
public HashSet<E> getNullifiableEntityKeys()

Retrieve the set of EntityKeys representing nullifiable references

getOwnerIdback to summary
public Serializable getOwnerId(String entity, String property, Object childObject, Map<K, V> mergeMap)

Search the persistence context for an owner for the child object, given a collection role

getProxyback to summary
public Object getProxy(EntityKey key)

Get an existing proxy by key

getSessionback to summary
public SessionImplementor getSession()

Get the session to which this persistence context is bound.

Returns:SessionImplementor

The session.

getSnapshotback to summary
public Serializable getSnapshot(PersistentCollection coll)

Get the snapshot of the pre-flush collection state

hasNonReadOnlyEntitiesback to summary
public boolean hasNonReadOnlyEntities()
Returns:boolean

false if we know for certain that all the entities are read-only

incrementCascadeLevelback to summary
public int incrementCascadeLevel()

Called before cascading

initializeNonLazyCollectionsback to summary
public void initializeNonLazyCollections() throws HibernateException

Force initialization of all non-lazy collections encountered during the current two-phase load (actually, this is a no-op, unless this is the "outermost" load)

isDefaultReadOnlyback to summary
public boolean isDefaultReadOnly()

Will entities and proxies that are loaded into this persistence context be made read-only by default? To determine the read-only/modifiable setting for a particular entity or proxy:

Returns:boolean

true, loaded entities/proxies will be made read-only by default; false, loaded entities/proxies will be made modifiable by default.

See Also
PersistenceContext#isReadOnly(Object), org.hibernate.Session#isReadOnly(Object), org.hibernate.Session#isDefaultReadOnly()
isEntryForback to summary
public boolean isEntryFor(Object entity)

Is there an EntityEntry for this instance?

isFlushingback to summary
public boolean isFlushing()

Is a flush cycle currently in process?

isLoadFinishedback to summary
public boolean isLoadFinished()

Is in a two-phase load?

isPropertyNullback to summary
public boolean isPropertyNull(EntityKey ownerKey, String propertyName)

Is the association property belonging to the keyed entity null?

isReadOnlyback to summary
public boolean isReadOnly(Object entityOrProxy)

Is the entity or proxy read-only? To get the default read-only/modifiable setting used for entities and proxies that are loaded into the session:

Returns:boolean

true, the object is read-only; false, the object is modifiable.

See Also
org.hibernate.Session#isDefaultReadOnly()
isStatelessback to summary
public boolean isStateless()
narrowProxyback to summary
public Object narrowProxy(Object proxy, EntityPersister persister, EntityKey key, Object object) throws HibernateException

If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy and overwrite the registration of the old one. This breaks == and occurs only for "class" proxies rather than "interface" proxies. Also init the proxy to point to the given target implementation if necessary.

Parameters
proxy:Object

The proxy instance to be narrowed.

persister:EntityPersister

The persister for the proxied entity.

key:EntityKey

The internal cache key for the proxied entity.

object:Object

(optional) the actual proxied entity instance.

Returns:Object

An appropriately narrowed instance.

proxyForback to summary
public Object proxyFor(EntityPersister persister, EntityKey key, Object impl) throws HibernateException

Return the existing proxy associated with the given EntityKey, or the third argument (the entity associated with the key) if no proxy exists. Init the proxy to the target implementation, if necessary.

proxyForback to summary
public Object proxyFor(Object impl) throws HibernateException

Return the existing proxy associated with the given EntityKey, or the argument (the entity associated with the key) if no proxy exists. (slower than the form above)

reassociateIfUninitializedProxyback to summary
public boolean reassociateIfUninitializedProxy(Object value) throws MappingException

Takes the given object and, if it represents a proxy, reassociates it with this event source.

Parameters
value:Object

The possible proxy to be reassociated.

Returns:boolean

Whether the passed value represented an actual proxy which got initialized.

reassociateProxyback to summary
public void reassociateProxy(Object value, Serializable id) throws MappingException

If a deleted entity instance is re-saved, and it has a proxy, we need to reset the identifier of the proxy

registerInsertedKeyback to summary
public void registerInsertedKey(EntityPersister persister, Serializable id)

Register keys inserted during the current transaction

Parameters
persister:EntityPersister

The entity persister

id:Serializable

The id

removeChildParentback to summary
public void removeChildParent(Object child)

Remove child/parent relation from cache

removeCollectionHolderback to summary
public PersistentCollection removeCollectionHolder(Object array)

Remove the mapping of collection to holder during eviction of the owning entity

removeEntityback to summary
public Object removeEntity(EntityKey key)

Remove an entity from the session cache, also clear up other state associated with the entity, all except for the EntityEntry

removeEntryback to summary
public EntityEntry removeEntry(Object entity)

Remove an entity entry from the session cache

removeProxyback to summary
public Object removeProxy(EntityKey key)

Remove a proxy from the session cache

replaceDelayedEntityIdentityInsertKeysback to summary
public void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId)
setDefaultReadOnlyback to summary
public void setDefaultReadOnly(boolean readOnly)

Change the default for entities and proxies loaded into this persistence context from modifiable to read-only mode, or from modifiable to read-only mode. Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted. When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the persistence context's current setting. To change the read-only/modifiable setting for a particular entity or proxy that is already in this session: + * @see PersistenceContext#setReadOnly(Object,boolean)

Parameters
readOnly:boolean

true, the default for loaded entities/proxies is read-only; false, the default for loaded entities/proxies is modifiable

See Also
To override this session's read-only/modifiable setting for entities and proxies loaded by a Query:, org.hibernate.Query#setReadOnly(boolean), org.hibernate.Session#setDefaultReadOnly(boolean)
setEntryStatusback to summary
public void setEntryStatus(EntityEntry entry, Status status)

Set the status of an entry

setFlushingback to summary
public void setFlushing(boolean flushing)

Called before and after the flushcycle

setReadOnlyback to summary
public void setReadOnly(Object entityOrProxy, boolean readOnly)

Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode. Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted. When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting. If the entity or proxy already has the specified read-only/modifiable setting, then this method does nothing. To set the default read-only/modifiable setting used for entities and proxies that are loaded into this persistence context:

Parameters
entityOrProxy:Object

an entity or HibernateProxy

readOnly:boolean

if true, the entity or proxy is made read-only; if false, the entity or proxy is made modifiable.

See Also
PersistenceContext#setDefaultReadOnly(boolean), To override this persistence context's read-only/modifiable setting for entities and proxies loaded by a Query:, org.hibernate.Query#setReadOnly(boolean), org.hibernate.Session#setReadOnly(Object, boolean)
toStringback to summary
public String toString()

Returns a string representation of the object.

Returns:String

a string representation of the object.

unproxyback to summary
public Object unproxy(Object maybeProxy) throws HibernateException

Get the entity instance underlying the given proxy, throwing an exception if the proxy is uninitialized. If the given object is not a proxy, simply return the argument.

unproxyAndReassociateback to summary
public Object unproxyAndReassociate(Object maybeProxy) throws HibernateException

Possibly unproxy the given reference and reassociate it with the current session.

Parameters
maybeProxy:Object

The reference to be unproxied if it currently represents a proxy.

Returns:Object

The unproxied instance.

useUnownedCollectionback to summary
public PersistentCollection useUnownedCollection(CollectionKey key)

Get and remove a collection whose owner is not yet loaded, when its owner is being loaded

wasInsertedDuringTransactionback to summary
public boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id)

Allows callers to check to see if the identified entity was inserted during the current transaction.

Parameters
persister:EntityPersister

The entity persister

id:Serializable

The id

Returns:boolean

True if inserted during this transaction, false otherwise.