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
  • Constructor Details

  • Method Details

    • removeEntity

      public void removeEntity​(SecurityEntity entity) throws DataBackendException
      Deletes an entity object
      Specified by:
      removeEntity in interface PersistenceHelper
      Parameters:
      entity - The object to be removed
      Throws:
      DataBackendException - if there was an error accessing the data backend.
    • updateEntity

      public void updateEntity​(SecurityEntity entity) throws DataBackendException
      Stores changes made to an object
      Specified by:
      updateEntity in interface PersistenceHelper
      Parameters:
      entity - The object to be saved
      Throws:
      DataBackendException - if there was an error accessing the data backend.
    • addEntity

      public void addEntity​(SecurityEntity entity) throws DataBackendException
      adds an entity
      Specified by:
      addEntity in interface PersistenceHelper
      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.HibernateException
      Returns a hibernate session, or if is null, opens one.
      Specified by:
      retrieveSession in interface PersistenceHelper
      Returns:
      An Open hibernate session.
      Throws:
      org.hibernate.HibernateException - generic exception
    • getConfiguration

      public org.hibernate.cfg.Configuration getConfiguration()
      Specified by:
      getConfiguration in interface PersistenceHelper
      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.HibernateException
      Lazy loads the sessionFactory if it hasn't been requested yet.
      Returns:
      the hibernate service
      Throws:
      org.hibernate.HibernateException
    • initialize

      public void initialize() throws Exception
      Specified by:
      initialize in interface org.apache.avalon.framework.activity.Initializable
      Throws:
      Exception
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.apache.avalon.framework.activity.Disposable
      Overrides:
      dispose in class AbstractManager
    • configure

      public void configure​(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
      Specified by:
      configure in interface org.apache.avalon.framework.configuration.Configurable
      Throws:
      org.apache.avalon.framework.configuration.ConfigurationException