|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.seam.persistence.DefaultPersistenceProvider
public class DefaultPersistenceProvider
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 |
DefaultPersistenceProvider.Feature
|
| Field Summary | |
|---|---|
protected Set<DefaultPersistenceProvider.Feature> |
featureSet
|
| Constructor Summary | |
|---|---|
DefaultPersistenceProvider()
|
|
| Method Summary | |
|---|---|
void |
checkVersion(Object bean,
EntityManager entityManager,
Object oldVersion,
Object version)
|
Set<Class<?>> |
getAdditionalEntityManagerInterfaces()
|
Class<?> |
getBeanClass(Object bean)
Returns the class of an entity bean instance |
Object |
getId(Object bean,
EntityManager entityManager)
Get the value of the entity identifier attribute. |
String |
getName(Object bean,
EntityManager entityManager)
Get the name of the entity |
Method |
getPostLoadMethod(Object bean,
EntityManager entityManager)
|
Method |
getPrePersistMethod(Object bean,
EntityManager entityManager)
|
Method |
getPreRemoveMethod(Object bean,
EntityManager entityManager)
|
Method |
getPreUpdateMethod(Object bean,
EntityManager entityManager)
|
FlushModeType |
getRenderFlushMode()
Gets the FlushMode the persistence contexts should use during rendering |
Object |
getVersion(Object bean,
EntityManager entityManager)
Get the value of the entity version attribute. |
boolean |
isCorrectProvider(EntityManager em)
Should return true if this is the correct persistence provider for the given entity manager factory |
boolean |
isDirty(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 |
EntityManager |
proxyEntityManager(EntityManager entityManager)
|
boolean |
registerSynchronization(Synchronization sync,
EntityManager entityManager)
Register a Synchronization with the current transaction. |
void |
setFlushMode(EntityManager entityManager,
FlushModeType type)
sets the flush mode |
void |
setFlushModeManual(EntityManager entityManager)
Set the flush mode to manual-only flushing. |
boolean |
supportsFeature(DefaultPersistenceProvider.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<DefaultPersistenceProvider.Feature> featureSet
| Constructor Detail |
|---|
public DefaultPersistenceProvider()
| Method Detail |
|---|
public boolean supportsFeature(DefaultPersistenceProvider.Feature feature)
public boolean isCorrectProvider(EntityManager em)
SeamPersistenceProvider
isCorrectProvider in interface SeamPersistenceProvider
public void setFlushMode(EntityManager entityManager,
FlushModeType type)
SeamPersistenceProvider
setFlushMode in interface SeamPersistenceProviderpublic void setFlushModeManual(EntityManager entityManager)
SeamPersistenceProvider
setFlushModeManual in interface SeamPersistenceProviderpublic FlushModeType getRenderFlushMode()
SeamPersistenceProviderGets the FlushMode the persistence contexts should use during rendering
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.
getRenderFlushMode in interface SeamPersistenceProviderpublic boolean isDirty(EntityManager entityManager)
SeamPersistenceProvider
isDirty in interface SeamPersistenceProvider
public Object getId(Object bean,
EntityManager entityManager)
SeamPersistenceProvider
getId in interface SeamPersistenceProviderbean - a managed entity instance
public String getName(Object bean,
EntityManager entityManager)
throws IllegalArgumentException
SeamPersistenceProvider
getName in interface SeamPersistenceProviderIllegalArgumentException - if the passed object is not an entity
public Object getVersion(Object bean,
EntityManager entityManager)
SeamPersistenceProvider
getVersion in interface SeamPersistenceProviderbean - a managed entity instance
public void checkVersion(Object bean,
EntityManager entityManager,
Object oldVersion,
Object version)
checkVersion in interface SeamPersistenceProvider
public boolean registerSynchronization(Synchronization sync,
EntityManager entityManager)
SeamPersistenceProvider
registerSynchronization in interface SeamPersistenceProviderpublic Object proxyDelegate(Object delegate)
SeamPersistenceProvider
proxyDelegate in interface SeamPersistenceProviderpublic EntityManager proxyEntityManager(EntityManager entityManager)
proxyEntityManager in interface SeamPersistenceProviderpublic Set<Class<?>> getAdditionalEntityManagerInterfaces()
getAdditionalEntityManagerInterfaces in interface SeamPersistenceProviderpublic Class<?> getBeanClass(Object bean)
SeamPersistenceProvider
getBeanClass in interface SeamPersistenceProviderbean - The entity bean instance
public Method getPostLoadMethod(Object bean,
EntityManager entityManager)
public Method getPrePersistMethod(Object bean,
EntityManager entityManager)
public Method getPreUpdateMethod(Object bean,
EntityManager entityManager)
public Method getPreRemoveMethod(Object bean,
EntityManager entityManager)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||