org.jboss.seam.persistence
Class AbstractPersistenceProvider

java.lang.Object
  extended by org.jboss.seam.persistence.AbstractPersistenceProvider

public abstract class AbstractPersistenceProvider
extends Object

Provides a default implementation of PersistenceProvider methods where possible Other methods must be implemented

Author:
Pete Muir

Constructor Summary
AbstractPersistenceProvider()
           
 
Method Summary
 void checkVersion(Object bean, javax.persistence.EntityManager entityManager, Object oldVersion, Object version)
           
abstract  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, javax.persistence.EntityManager entityManager)
           
 Method getPrePersistMethod(Class beanClass, javax.persistence.EntityManager entityManager)
           
 Method getPreRemoveMethod(Class beanClass, javax.persistence.EntityManager entityManager)
           
 Method getPreUpdateMethod(Class beanClass, javax.persistence.EntityManager entityManager)
           
 Object getVersion(Object bean, javax.persistence.EntityManager entityManager)
          Get the value of the entity version attribute.
abstract  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
abstract  boolean registerSynchronization(Synchronization sync, javax.persistence.EntityManager entityManager)
          Register a Synchronization with the current transaction.
abstract  void setFlushModeManual(javax.persistence.EntityManager entityManager)
          Set the flush mode to manual-only flushing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPersistenceProvider

public AbstractPersistenceProvider()
Method Detail

setFlushModeManual

public abstract void setFlushModeManual(javax.persistence.EntityManager entityManager)
Set the flush mode to manual-only flushing. Called when an atomic persistence context is required.


isDirty

public abstract boolean isDirty(javax.persistence.EntityManager entityManager)
Does the persistence context have unflushed changes? If it does not, persistence context replication can be optimized.

Returns:
true to indicate that there are unflushed changes

getId

public Object getId(Object bean,
                    javax.persistence.EntityManager entityManager)
Get the value of the entity identifier attribute.

Parameters:
bean - a managed entity instance

getName

public String getName(Object bean,
                      javax.persistence.EntityManager entityManager)
               throws IllegalArgumentException
Get the name of the entity

Parameters:
bean -
entityManager -
Throws:
IllegalArgumentException - if the passed object is not an entity

getVersion

public Object getVersion(Object bean,
                         javax.persistence.EntityManager entityManager)
Get the value of the entity version attribute.

Parameters:
bean - a managed entity instance

checkVersion

public void checkVersion(Object bean,
                         javax.persistence.EntityManager entityManager,
                         Object oldVersion,
                         Object version)

enableFilter

public abstract void enableFilter(Filter filter,
                                  javax.persistence.EntityManager entityManager)
Enable a Filter. This is here just especially for Hibernate, since we well know that other products don't have such cool features.


registerSynchronization

public abstract boolean registerSynchronization(Synchronization sync,
                                                javax.persistence.EntityManager entityManager)
Register a Synchronization with the current transaction.


proxyDelegate

public Object proxyDelegate(Object delegate)
Wrap the delegate before returning it to the application


proxyEntityManager

public javax.persistence.EntityManager proxyEntityManager(javax.persistence.EntityManager entityManager)
Wrap the entityManager before returning it to the application


getBeanClass

public Class getBeanClass(Object bean)
Returns the class of an entity bean instance

Parameters:
bean - The entity bean instance
Returns:
The class of the entity bean

getPostLoadMethod

public Method getPostLoadMethod(Class beanClass,
                                javax.persistence.EntityManager entityManager)

getPrePersistMethod

public Method getPrePersistMethod(Class beanClass,
                                  javax.persistence.EntityManager entityManager)

getPreUpdateMethod

public Method getPreUpdateMethod(Class beanClass,
                                 javax.persistence.EntityManager entityManager)

getPreRemoveMethod

public Method getPreRemoveMethod(Class beanClass,
                                 javax.persistence.EntityManager entityManager)


Copyright © 2011 Seam Framework. All Rights Reserved.