public interface PersistenceContext
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.
Modifier and Type | Interface and Description |
---|---|
static class |
PersistenceContext.WithOption
Wrapper on a bean to also indicate if a bean has been deleted.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all the references.
|
void |
clear(Class<?> rootType)
Clear all the references for a given type of entity bean.
|
void |
clear(Class<?> rootType,
Object uid)
Clear the reference to a specific entity bean.
|
void |
deleted(Class<?> rootType,
Object id)
Clear the reference as a result of an entity being deleted.
|
Object |
get(Class<?> rootType,
Object uid)
Return an object given its type and unique id.
|
PersistenceContext.WithOption |
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(Class<?> rootType,
Object id,
Object bean)
Put the entity bean into the PersistenceContext.
|
Object |
putIfAbsent(Class<?> rootType,
Object id,
Object bean)
Put the entity bean into the PersistenceContext if one is not already
present (for this id).
|
int |
size(Class<?> rootType)
Return the number of beans of the given type in the persistence context.
|
void put(Class<?> rootType, Object id, Object bean)
Object putIfAbsent(Class<?> rootType, Object id, Object bean)
Returns an existing entity bean (if one is already there) and otherwise returns null.
PersistenceContext.WithOption getWithOption(Class<?> rootType, Object uid)
void clear()
void deleted(Class<?> rootType, Object id)
Copyright © 2018. All rights reserved.