|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.pimento.adapter.JpaPersistenceAdapter
public class JpaPersistenceAdapter
PersistenceAdapter implementation that manages JPA entities. This is the only built-in implementation of the PersistenceAdapter interface.
| Constructor Summary | |
|---|---|
JpaPersistenceAdapter()
Creates a new instance. |
|
| Method Summary | |
|---|---|
List<Entity> |
createEntities(MetamodelBuilderFactory factory)
Creates the metamodel for all persistent entities managed by Pimento. |
Object |
executeQuery(Query clientQuery,
boolean executeUpdatePermitted)
Executes the specified query and returns the result. |
JpaProvider |
getJpaProvider()
Returns the JPA provider in use. |
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 |
setDefaultOperations(Set<Operation> operations)
Sets the default EntityManager operations permitted on the client side. |
void |
setJpaProvider(JpaProvider jpaProvider)
Sets the JPA provider. |
void |
update(Object entity)
Updates the specified entity. |
boolean |
useAutoCascade()
Specifies whether automatic cascading should be performed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JpaPersistenceAdapter()
| Method Detail |
|---|
public JpaProvider getJpaProvider()
JpaProvider interface allows to hook different
JPA implementations into Pimento. Out-of-the-box only Hibernate
is supported, but any other JPA provider can be used if you provide
a corresponding JpaProvider implementation.
public void setJpaProvider(JpaProvider jpaProvider)
JpaProvider interface allows to hook different
JPA implementations into Pimento. Out-of-the-box only Hibernate
is supported, but any other JPA provider can be used if you provide
a corresponding JpaProvider implementation.
jpaProvider - the JPA provider to usepublic void setDefaultOperations(Set<Operation> operations)
@Managed
annotation. If no default operations are set, entities without the @Managed
annotation won't be managed by Pimento at all.
operations - the default EntityManager operations permitted on the client sidepublic List<Entity> createEntities(MetamodelBuilderFactory factory)
PersistenceAdapter
createEntities in interface PersistenceAdapterfactory - the factory to use for creating MetamodelBuilder instances
public Object executeQuery(Query clientQuery,
boolean executeUpdatePermitted)
PersistenceAdapter
executeQuery in interface PersistenceAdapterclientQuery - the query to executeexecuteUpdatePermitted - whether updates are allowed
public Object getReference(Class<?> persistentClass,
Object primaryKey)
PersistenceAdapter
getReference in interface PersistenceAdapterpersistentClass - the entity typeprimaryKey - the primary key of the entity
public Object load(Class<?> persistentClass,
Object primaryKey)
PersistenceAdapter
load in interface PersistenceAdapterpersistentClass - the entity typeprimaryKey - the primary key of the entity
public void persist(Object entity)
PersistenceAdapter
persist in interface PersistenceAdapterentity - the entity to persistpublic void update(Object entity)
PersistenceAdapter
update in interface PersistenceAdapterentity - the entity to updatepublic void remove(Object entity)
PersistenceAdapter
remove in interface PersistenceAdapterentity - the entity to removepublic boolean isUninitializedProxy(Object entity)
PersistenceAdapter
isUninitializedProxy in interface PersistenceAdapterentity - the entity or collection to check
public boolean useAutoCascade()
PersistenceAdapterpersist 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.
useAutoCascade in interface PersistenceAdapter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||