public interface PersistenceContext
Holds entity beans by there type and id.
This is used to ensure only one instance for a given entity type and id is used to build object graphs from queries and lazy loading.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Wrapper on a bean to also indicate if a bean has been deleted. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Signalizes the PersistenceContext, the begin for large query iteration.void
clear()
Clear all the references.void
Clear all the references for a given type of entity bean.void
Clear the reference to a specific entity bean.void
Clear the reference as a result of an entity being deleted.void
Signalizes the PersistenceContext, the end for large query iteration.Return an object given its type and unique id.getWithOption
(Class<?> rootType, Object uid) Get the bean from the persistence context also checked to see if it had been previously deleted (if so then you also can't hit the L2 cache to fetch the bean for this particular persistence context).void
Put the entity bean into the PersistenceContext.putIfAbsent
(Class<?> rootType, Object id, Object bean) Put the entity bean into the PersistenceContext if one is not already present (for this id).int
Return the number of beans of the given type in the persistence context.
-
Method Details
-
put
Put the entity bean into the PersistenceContext. -
putIfAbsent
Put the entity bean into the PersistenceContext if one is not already present (for this id).Returns an existing entity bean (if one is already there) and otherwise returns null.
-
get
Return an object given its type and unique id. -
getWithOption
Get the bean from the persistence context also checked to see if it had been previously deleted (if so then you also can't hit the L2 cache to fetch the bean for this particular persistence context). -
clear
void clear()Clear all the references. -
clear
Clear all the references for a given type of entity bean. -
clear
Clear the reference to a specific entity bean. -
deleted
Clear the reference as a result of an entity being deleted. -
size
Return the number of beans of the given type in the persistence context. -
beginIterate
void beginIterate()Signalizes the PersistenceContext, the begin for large query iteration. -
endIterate
void endIterate()Signalizes the PersistenceContext, the end for large query iteration.
-