org.compass.gps.device.jpa.lifecycle
Class HibernateJpaEntityLifecycleInjector
java.lang.Object
org.compass.gps.device.jpa.lifecycle.HibernateJpaEntityLifecycleInjector
- All Implemented Interfaces:
- JpaEntityLifecycleInjector
- Direct Known Subclasses:
- HibernateJpaEntityCollectionLifecycleInjector
public class HibernateJpaEntityLifecycleInjector
- extends Object
- implements JpaEntityLifecycleInjector
Injects lifecycle listeners directly into Hibernate for mirroring operations.
By default, registers with plain insert/update/delete listeners, which will be triggered
by Hibernate before committing (and up to Hibernate flushing logic). Also allows to be created
with setting the registerPostCommitListeneres to true which will cause
the insert/update/delete listeneres to be registered as post commit events.
- Author:
- kimchy
|
Method Summary |
protected Object |
doCreateListener(JpaGpsDevice device)
|
void |
injectLifecycle(javax.persistence.EntityManagerFactory entityManagerFactory,
JpaGpsDevice device)
Injects a global lifecycle listener into the concrete EntityManagerFactory
implementation. |
void |
removeLifecycle(javax.persistence.EntityManagerFactory entityManagerFactory,
JpaGpsDevice device)
Removes (if possible) lifecycle listeners injected using the inject method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
registerPostCommitListeneres
protected final boolean registerPostCommitListeneres
HibernateJpaEntityLifecycleInjector
public HibernateJpaEntityLifecycleInjector()
HibernateJpaEntityLifecycleInjector
public HibernateJpaEntityLifecycleInjector(boolean registerPostCommitListeneres)
- Creates a new lifecycle injector. Allows to control if the insert/update/delete
even listeners will be registered with post commit listeres (flag it
true)
or with plain post events (triggered based on Hibrenate flushing logic).
- Parameters:
registerPostCommitListeneres - true if post commit listeners will be
registered. false for plain listeners.
injectLifecycle
public void injectLifecycle(javax.persistence.EntityManagerFactory entityManagerFactory,
JpaGpsDevice device)
throws JpaGpsDeviceException
- Description copied from interface:
JpaEntityLifecycleInjector
- Injects a global lifecycle listener into the concrete
EntityManagerFactory
implementation.
- Specified by:
injectLifecycle in interface JpaEntityLifecycleInjector
- Parameters:
entityManagerFactory - The EntityManagerFactory to inject the global lifecycle to.device - The Jpa device calling this injector
- Throws:
JpaGpsDeviceException
removeLifecycle
public void removeLifecycle(javax.persistence.EntityManagerFactory entityManagerFactory,
JpaGpsDevice device)
throws JpaGpsDeviceException
- Description copied from interface:
JpaEntityLifecycleInjector
- Removes (if possible) lifecycle listeners injected using the inject method.
- Specified by:
removeLifecycle in interface JpaEntityLifecycleInjector
- Parameters:
entityManagerFactory - The EMF to remove lifecycle fromdevice - The Jpa device calling
- Throws:
JpaGpsDeviceException
doCreateListener
protected Object doCreateListener(JpaGpsDevice device)
Copyright (c) 2004-2008 The Compass Project.