|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface PersistenceAdapter
Extension point that allows to create a custom adapter for a data source.
The only built-in implementation is the JpaPersistenceAdapter that manages
JPA entities. To register custom implementations they only need to be added to the
Spring ApplicationContext.
| Method Summary | |
|---|---|
List<Entity> |
createEntities(MetamodelBuilderFactory factory)
Creates the metamodel for all persistent entities managed by Pimento. |
Object |
executeQuery(Query query,
boolean executeUpdatePermitted)
Executes the specified query and returns the result. |
Object |
getReference(Class<?> persistentClass,
Object primaryKey)
Returns a reference for the specified entity type and primary key. |
boolean |
isUninitializedProxy(Object entity)
Checks whether the specified entity or collection is an uninitialized proxy. |
Object |
load(Class<?> persistentClass,
Object primaryKey)
Loads the entity with the specified type and primary key. |
void |
persist(Object entity)
Persists the specified entity. |
void |
remove(Object entity)
Removes the specified entity. |
void |
update(Object entity)
Updates the specified entity. |
boolean |
useAutoCascade()
Specifies whether automatic cascading should be performed. |
| Method Detail |
|---|
List<Entity> createEntities(MetamodelBuilderFactory factory)
factory - the factory to use for creating MetamodelBuilder instances
boolean isUninitializedProxy(Object entity)
entity - the entity or collection to check
Object getReference(Class<?> persistentClass,
Object primaryKey)
persistentClass - the entity typeprimaryKey - the primary key of the entity
Object load(Class<?> persistentClass,
Object primaryKey)
persistentClass - the entity typeprimaryKey - the primary key of the entity
void persist(Object entity)
entity - the entity to persistvoid update(Object entity)
entity - the entity to updatevoid remove(Object entity)
entity - the entity to remove
Object executeQuery(Query query,
boolean executeUpdatePermitted)
query - the query to executeexecuteUpdatePermitted - whether updates are allowed
boolean useAutoCascade()
persist or update respectively.
In this case the persistence adapter itself is responsible for determining cascading
behaviour. An example is the built-in JpaPersistenceAdapter where cascading
behaviour will be determined by the JPA configuration (annotations or XML).
This method does not affect remove operations where Pimento will always only pass the
root object to the persistence adapter. It is always the responsibility of a persistence
adapter to determine cascading behaviour for remove operations.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||