com.avaje.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.


Method Summary
 void clear()
          Clear all the references.
 void clear(Class<?> beanType)
          Clear all the references for a given type of entity bean.
 void clear(Class<?> beanType, Object uid)
          Clear the reference to a specific entity bean.
 Object get(Class<?> beanType, Object uid)
          Return an object given its type and unique id.
 void put(Object id, Object bean)
          Put the entity bean into the PersistanceContext.
 Object putIfAbsent(Object id, Object bean)
          Put the entity bean into the PersistanceContext if one is not already present (for this id).
 int size(Class<?> beanType)
          Return the number of beans of the given type in the persistence context.
 

Method Detail

put

void put(Object id,
         Object bean)
Put the entity bean into the PersistanceContext.


putIfAbsent

Object putIfAbsent(Object id,
                   Object bean)
Put the entity bean into the PersistanceContext if one is not already present (for this id).

Returns an existing entity bean (if one is already there) and otherwise returns null.


get

Object get(Class<?> beanType,
           Object uid)
Return an object given its type and unique id.


clear

void clear()
Clear all the references.


clear

void clear(Class<?> beanType)
Clear all the references for a given type of entity bean.


clear

void clear(Class<?> beanType,
           Object uid)
Clear the reference to a specific entity bean.


size

int size(Class<?> beanType)
Return the number of beans of the given type in the persistence context.



Copyright © 2010. All Rights Reserved.