org.granite.tide.data
Class JPAPersistenceAdapter

java.lang.Object
  extended by org.granite.tide.data.JPAPersistenceAdapter
All Implemented Interfaces:
TidePersistenceAdapter

public class JPAPersistenceAdapter
extends Object
implements TidePersistenceAdapter

Implementation of Tide persistence adapter with a JPA EntityManager

Author:
William DRAI

Field Summary
protected  EntityManager entityManager
           
 
Constructor Summary
JPAPersistenceAdapter(EntityManager entityManager)
           
 
Method Summary
 Object find(Class<?> entityClass, Serializable id)
          Find an entity in the persistence context
 void throwOptimisticLockException(Object entity)
          Throw an optimistic locking error
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entityManager

protected EntityManager entityManager
Constructor Detail

JPAPersistenceAdapter

public JPAPersistenceAdapter(EntityManager entityManager)
Method Detail

find

public Object find(Class<?> entityClass,
                   Serializable id)
Find an entity in the persistence context

Specified by:
find in interface TidePersistenceAdapter
Parameters:
entityClass - class of the looked up entity
id - entity identifier
Returns:
the entity with the persistence context.

throwOptimisticLockException

public void throwOptimisticLockException(Object entity)
Throw an optimistic locking error

Specified by:
throwOptimisticLockException in interface TidePersistenceAdapter
Parameters:
entity - entity instance loaded from the database