Class PersistenceHelperDefaultImpl
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.security.spi.AbstractManager
org.apache.fulcrum.security.hibernate.PersistenceHelperDefaultImpl
- All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable,org.apache.avalon.framework.activity.Initializable,org.apache.avalon.framework.configuration.Configurable,org.apache.avalon.framework.logger.LogEnabled,org.apache.avalon.framework.service.Serviceable,org.apache.avalon.framework.thread.ThreadSafe,PersistenceHelper
public class PersistenceHelperDefaultImpl extends AbstractManager implements PersistenceHelper, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Disposable
This persistenceHelper expects you to either pass in a SessionFactory to use,
or it will create one from a hibernate.cfg.xml in the root of the classpath.
- Version:
- $Id: PersistenceHelperDefaultImpl.java 1374014 2012-08-16 19:47:27Z tv $
- Author:
- Eric Pugh
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PersistenceHelperDefaultImpl() -
Method Summary
Modifier and Type Method Description voidaddEntity(SecurityEntity entity)adds an entityvoidconfigure(org.apache.avalon.framework.configuration.Configuration conf)voiddispose()org.hibernate.cfg.ConfigurationgetConfiguration()org.hibernate.SessionFactorygetSessionFactory()Lazy loads the sessionFactory if it hasn't been requested yet.voidinitialize()voidremoveEntity(SecurityEntity entity)Deletes an entity objectorg.hibernate.SessionretrieveSession()Returns a hibernate session, or if is null, opens one.voidsetSessionFactory(org.hibernate.SessionFactory sessionFactory)In some environments we will load the session factory up and pass it in.voidupdateEntity(SecurityEntity entity)Stores changes made to an objectMethods inherited from class org.apache.fulcrum.security.spi.AbstractManager
getGroupManager, getPermissionManager, getRoleManager, getServiceManager, getUserManager, release, resolve, service
-
Constructor Details
-
PersistenceHelperDefaultImpl
public PersistenceHelperDefaultImpl()
-
-
Method Details
-
removeEntity
Deletes an entity object- Specified by:
removeEntityin interfacePersistenceHelper- Parameters:
entity- The object to be removed- Throws:
DataBackendException- if there was an error accessing the data backend.
-
updateEntity
Stores changes made to an object- Specified by:
updateEntityin interfacePersistenceHelper- Parameters:
entity- The object to be saved- Throws:
DataBackendException- if there was an error accessing the data backend.
-
addEntity
adds an entity- Specified by:
addEntityin interfacePersistenceHelper- Parameters:
entity- The object to be saved- Throws:
DataBackendException- if there was an error accessing the data backend.
-
retrieveSession
public org.hibernate.Session retrieveSession() throws org.hibernate.HibernateExceptionReturns a hibernate session, or if is null, opens one.- Specified by:
retrieveSessionin interfacePersistenceHelper- Returns:
- An Open hibernate session.
- Throws:
org.hibernate.HibernateException- generic exception
-
getConfiguration
public org.hibernate.cfg.Configuration getConfiguration()- Specified by:
getConfigurationin interfacePersistenceHelper- Returns:
- the hibernate configuration
-
setSessionFactory
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)In some environments we will load the session factory up and pass it in.- Parameters:
sessionFactory- The hibernateService to set.
-
getSessionFactory
public org.hibernate.SessionFactory getSessionFactory() throws org.hibernate.HibernateExceptionLazy loads the sessionFactory if it hasn't been requested yet.- Returns:
- the hibernate service
- Throws:
org.hibernate.HibernateException
-
initialize
- Specified by:
initializein interfaceorg.apache.avalon.framework.activity.Initializable- Throws:
Exception
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.apache.avalon.framework.activity.Disposable- Overrides:
disposein classAbstractManager
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException- Specified by:
configurein interfaceorg.apache.avalon.framework.configuration.Configurable- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
-