|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.seam.persistence.PersistenceProvider
@Name(value="org.jboss.seam.persistence.persistenceProvider") @Scope(value=STATELESS) @BypassInterceptors @Install(precedence=0, classDependencies="javax.persistence.EntityManager") public class PersistenceProvider
Abstraction layer for persistence providers (JPA implementations). This class provides a working base implementation that can be optimized for performance and non-standardized features by extending and overriding the methods. The methods on this class are a great todo list for the next rev of the JPA spec ;-)
Nested Class Summary | |
---|---|
static class |
PersistenceProvider.Feature
|
Field Summary | |
---|---|
protected Set<PersistenceProvider.Feature> |
featureSet
|
Constructor Summary | |
---|---|
PersistenceProvider()
|
Method Summary | |
---|---|
void |
checkVersion(Object bean,
javax.persistence.EntityManager entityManager,
Object oldVersion,
Object version)
|
void |
enableFilter(Filter filter,
javax.persistence.EntityManager entityManager)
Enable a Filter. |
Class |
getBeanClass(Object bean)
Returns the class of an entity bean instance |
Object |
getId(Object bean,
javax.persistence.EntityManager entityManager)
Get the value of the entity identifier attribute. |
String |
getName(Object bean,
javax.persistence.EntityManager entityManager)
Get the name of the entity |
Method |
getPostLoadMethod(Class beanClass)
Deprecated. |
Method |
getPostLoadMethod(Object bean,
javax.persistence.EntityManager entityManager)
|
Method |
getPrePersistMethod(Class beanClass)
Deprecated. |
Method |
getPrePersistMethod(Object bean,
javax.persistence.EntityManager entityManager)
|
Method |
getPreRemoveMethod(Class beanClass)
Deprecated. |
Method |
getPreRemoveMethod(Object bean,
javax.persistence.EntityManager entityManager)
|
Method |
getPreUpdateMethod(Class beanClass)
Deprecated. |
Method |
getPreUpdateMethod(Object bean,
javax.persistence.EntityManager entityManager)
|
Object |
getVersion(Object bean,
javax.persistence.EntityManager entityManager)
Get the value of the entity version attribute. |
void |
init()
|
static PersistenceProvider |
instance()
|
boolean |
isDirty(javax.persistence.EntityManager entityManager)
Does the persistence context have unflushed changes? If it does not, persistence context replication can be optimized. |
Object |
proxyDelegate(Object delegate)
Wrap the delegate before returning it to the application |
javax.persistence.EntityManager |
proxyEntityManager(javax.persistence.EntityManager entityManager)
Wrap the entityManager before returning it to the application |
boolean |
registerSynchronization(Synchronization sync,
javax.persistence.EntityManager entityManager)
Register a Synchronization with the current transaction. |
void |
setFlushModeManual(javax.persistence.EntityManager entityManager)
Set the flush mode to manual-only flushing. |
void |
setRenderFlushMode()
Set the FlushMode the persistence contexts should use during rendering by calling PersistenceContexts#changeFlushMode(FlushModeType, true) . |
boolean |
supportsFeature(PersistenceProvider.Feature feature)
Indicate whether this JPA provider supports the feature defined by the provided Feature enum value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Set<PersistenceProvider.Feature> featureSet
Constructor Detail |
---|
public PersistenceProvider()
Method Detail |
---|
@PostConstruct public void init()
public boolean supportsFeature(PersistenceProvider.Feature feature)
public void setFlushModeManual(javax.persistence.EntityManager entityManager)
public void setRenderFlushMode()
Set the FlushMode the persistence contexts should use during rendering by
calling PersistenceContexts#changeFlushMode(FlushModeType, true)
.
The actual changing of the flush mode is handled by the
PersistenceContexts
instance. The boolean argument should be true
to indicate that this is a temporary change and that the old flush mode
should be restored after render.
Ideally, this should be MANUAL since changes should never flush to the database while in render response and the cost of a dirty check can be avoided. However, since the MANUAL mode is not officially part of the JPA specification, the default implementation will perform no operation.
public boolean isDirty(javax.persistence.EntityManager entityManager)
public Object getId(Object bean, javax.persistence.EntityManager entityManager)
bean
- a managed entity instancepublic String getName(Object bean, javax.persistence.EntityManager entityManager) throws IllegalArgumentException
bean
- entityManager
-
IllegalArgumentException
- if the passed object is not an entitypublic Object getVersion(Object bean, javax.persistence.EntityManager entityManager)
bean
- a managed entity instancepublic void checkVersion(Object bean, javax.persistence.EntityManager entityManager, Object oldVersion, Object version)
public void enableFilter(Filter filter, javax.persistence.EntityManager entityManager)
public boolean registerSynchronization(Synchronization sync, javax.persistence.EntityManager entityManager)
public static PersistenceProvider instance()
public Object proxyDelegate(Object delegate)
public javax.persistence.EntityManager proxyEntityManager(javax.persistence.EntityManager entityManager)
public Class getBeanClass(Object bean)
bean
- The entity bean instance
public Method getPostLoadMethod(Object bean, javax.persistence.EntityManager entityManager)
public Method getPrePersistMethod(Object bean, javax.persistence.EntityManager entityManager)
public Method getPreUpdateMethod(Object bean, javax.persistence.EntityManager entityManager)
public Method getPreRemoveMethod(Object bean, javax.persistence.EntityManager entityManager)
@Deprecated public Method getPreRemoveMethod(Class beanClass)
@Deprecated public Method getPostLoadMethod(Class beanClass)
@Deprecated public Method getPrePersistMethod(Class beanClass)
@Deprecated public Method getPreUpdateMethod(Class beanClass)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |