org.granite.tide.hibernate
Class HibernatePersistenceAdapter

java.lang.Object
  extended by org.granite.tide.hibernate.HibernatePersistenceAdapter
All Implemented Interfaces:
TidePersistenceAdapter

public class HibernatePersistenceAdapter
extends Object
implements TidePersistenceAdapter

Implementation of Tide persistence adapter with a Hibernate Session

Author:
William DRAI

Constructor Summary
HibernatePersistenceAdapter(Session session)
           
HibernatePersistenceAdapter(SessionFactory sessionFactory)
           
 
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
 

Constructor Detail

HibernatePersistenceAdapter

public HibernatePersistenceAdapter(SessionFactory sessionFactory)

HibernatePersistenceAdapter

public HibernatePersistenceAdapter(Session session)
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