org.compass.gps.device.hibernate
Class CompassTransactionInterceptor
java.lang.Object
org.compass.gps.device.hibernate.CompassTransactionInterceptor
- All Implemented Interfaces:
- org.hibernate.Interceptor
public class CompassTransactionInterceptor
- extends Object
- implements org.hibernate.Interceptor
A Compass Hibernate interceptor to manage Compass transactions based on Hibernate
Interceptor transaction lifecycle callbacks. Useful when working with Compass Local
transactions and Hibernate JDBC transaction manager.
In order to use this interceptor call injectInterceptor(org.hibernate.SessionFactory, CompassTransactionInterceptor)
using the SessionFactory and an instance of this class.
For another option of integrating Compass transactions and Hibernate, please see
JTASyncTransactionFactory, XATransactionFactory
or HibernateSyncTransactionFactory.
- Author:
- kimchy
|
Method Summary |
void |
afterTransactionBegin(org.hibernate.Transaction transaction)
|
void |
afterTransactionCompletion(org.hibernate.Transaction transaction)
|
void |
beforeTransactionCompletion(org.hibernate.Transaction transaction)
|
int[] |
findDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
|
Object |
getEntity(String entityName,
Serializable id)
|
String |
getEntityName(Object object)
|
static void |
injectInterceptor(org.hibernate.SessionFactory sessionFactory,
CompassTransactionInterceptor interceptor)
|
Object |
instantiate(String entityName,
org.hibernate.EntityMode entityMode,
Serializable id)
|
Boolean |
isTransient(Object entity)
|
void |
onCollectionRecreate(Object collection,
Serializable key)
|
void |
onCollectionRemove(Object collection,
Serializable key)
|
void |
onCollectionUpdate(Object collection,
Serializable key)
|
void |
onDelete(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
|
boolean |
onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
|
boolean |
onLoad(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
|
String |
onPrepareStatement(String sql)
|
boolean |
onSave(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
|
void |
postFlush(Iterator entities)
|
void |
preFlush(Iterator entities)
|
(package private) void |
setInterceptor(org.hibernate.Interceptor interceptor)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompassTransactionInterceptor
public CompassTransactionInterceptor(Compass compass)
CompassTransactionInterceptor
public CompassTransactionInterceptor(Compass compass,
boolean commitBeforeTransactionCompletion,
org.hibernate.Interceptor interceptor)
injectInterceptor
public static void injectInterceptor(org.hibernate.SessionFactory sessionFactory,
CompassTransactionInterceptor interceptor)
throws Exception
- Throws:
Exception
setInterceptor
void setInterceptor(org.hibernate.Interceptor interceptor)
afterTransactionBegin
public void afterTransactionBegin(org.hibernate.Transaction transaction)
- Specified by:
afterTransactionBegin in interface org.hibernate.Interceptor
beforeTransactionCompletion
public void beforeTransactionCompletion(org.hibernate.Transaction transaction)
- Specified by:
beforeTransactionCompletion in interface org.hibernate.Interceptor
afterTransactionCompletion
public void afterTransactionCompletion(org.hibernate.Transaction transaction)
- Specified by:
afterTransactionCompletion in interface org.hibernate.Interceptor
onDelete
public void onDelete(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
- Specified by:
onDelete in interface org.hibernate.Interceptor
onFlushDirty
public boolean onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
- Specified by:
onFlushDirty in interface org.hibernate.Interceptor
onLoad
public boolean onLoad(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
- Specified by:
onLoad in interface org.hibernate.Interceptor
onSave
public boolean onSave(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
- Specified by:
onSave in interface org.hibernate.Interceptor
postFlush
public void postFlush(Iterator entities)
- Specified by:
postFlush in interface org.hibernate.Interceptor
preFlush
public void preFlush(Iterator entities)
- Specified by:
preFlush in interface org.hibernate.Interceptor
isTransient
public Boolean isTransient(Object entity)
- Specified by:
isTransient in interface org.hibernate.Interceptor
instantiate
public Object instantiate(String entityName,
org.hibernate.EntityMode entityMode,
Serializable id)
- Specified by:
instantiate in interface org.hibernate.Interceptor
findDirty
public int[] findDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
- Specified by:
findDirty in interface org.hibernate.Interceptor
getEntityName
public String getEntityName(Object object)
- Specified by:
getEntityName in interface org.hibernate.Interceptor
getEntity
public Object getEntity(String entityName,
Serializable id)
- Specified by:
getEntity in interface org.hibernate.Interceptor
onPrepareStatement
public String onPrepareStatement(String sql)
- Specified by:
onPrepareStatement in interface org.hibernate.Interceptor
onCollectionRemove
public void onCollectionRemove(Object collection,
Serializable key)
throws org.hibernate.CallbackException
- Specified by:
onCollectionRemove in interface org.hibernate.Interceptor
- Throws:
org.hibernate.CallbackException
onCollectionRecreate
public void onCollectionRecreate(Object collection,
Serializable key)
throws org.hibernate.CallbackException
- Specified by:
onCollectionRecreate in interface org.hibernate.Interceptor
- Throws:
org.hibernate.CallbackException
onCollectionUpdate
public void onCollectionUpdate(Object collection,
Serializable key)
throws org.hibernate.CallbackException
- Specified by:
onCollectionUpdate in interface org.hibernate.Interceptor
- Throws:
org.hibernate.CallbackException
Copyright (c) 2004-2006 The Compass Project.