
com.avaje.ebean.bean.PersistenceContext Maven / Gradle / Ivy
The newest version!
package com.avaje.ebean.bean;
/**
* 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.
*
*/
public interface PersistenceContext {
/**
* Put the entity bean into the PersistanceContext.
*/
public void put(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.
*
*/
public Object putIfAbsent(Object id, Object bean);
/**
* Return an object given its type and unique id.
*/
public Object get(Class> beanType, Object uid);
/**
* Clear all the references.
*/
public void clear();
/**
* Clear all the references for a given type of entity bean.
*/
public void clear(Class> beanType);
/**
* Clear the reference to a specific entity bean.
*/
public void clear(Class> beanType, Object uid);
/**
* Return the number of beans of the given type in the persistence context.
*/
public int size(Class> beanType);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy