Package io.ebean.bean
Interface PersistenceContext
-
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
Nested Classes Modifier and Type Interface Description static class
PersistenceContext.WithOption
Wrapper on a bean to also indicate if a bean has been deleted.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.PersistenceContext
forIterate()
Return a copy of the Persistence context to use for large query iteration.PersistenceContext
forIterateReset()
Return a new Persistence context during iteration of large query result.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).boolean
resetLimit()
Return true if the persistence context has grown and hit the 'reset limit' during large query iteration.int
size(Class<?> rootType)
Return the number of beans of the given type in the persistence context.
-
-
-
Method Detail
-
put
void put(Class<?> rootType, Object id, Object bean)
Put the entity bean into the PersistenceContext.
-
putIfAbsent
Object putIfAbsent(Class<?> rootType, Object id, Object bean)
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.
-
getWithOption
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).
-
clear
void clear()
Clear all the references.
-
deleted
void deleted(Class<?> rootType, Object id)
Clear the reference as a result of an entity being deleted.
-
size
int size(Class<?> rootType)
Return the number of beans of the given type in the persistence context.
-
forIterate
PersistenceContext forIterate()
Return a copy of the Persistence context to use for large query iteration.
-
forIterateReset
PersistenceContext forIterateReset()
Return a new Persistence context during iteration of large query result.
-
resetLimit
boolean resetLimit()
Return true if the persistence context has grown and hit the 'reset limit' during large query iteration.
-
-