ch.qos.logback.audit.persistent
Class Persistor

java.lang.Object
  extended by ch.qos.logback.audit.persistent.Persistor
Direct Known Subclasses:
AuditEventDAO

public class Persistor
extends Object

Base functionality "class" for all Persistor classes - this class only bundles static functions, has no members nor methods. Persistor includes functions to create or retrieve a Hibernate SessionFactory, and functions to open, close or rollback sessions.

Author:
Ceki Gülcü

Constructor Summary
Persistor()
           
 
Method Summary
protected static void close(org.hibernate.Session theHibernateSession)
          Close a Hibernate Session.
protected static void close(org.hibernate.Session theHibernateSession, org.hibernate.Transaction tx)
          Rollback a Hibernate transaction and close the session.
static org.hibernate.cfg.Configuration createConfiguration()
           
static void delete(Object o)
           
protected static org.hibernate.Session openSession()
          Open an Hibernate Session.
static void resetConfiguration(Object lock)
           
static void save(Object o)
           
static void setConfiguration(org.hibernate.cfg.Configuration cfg, Object lock)
           
protected static void update(Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Persistor

public Persistor()
Method Detail

createConfiguration

public static org.hibernate.cfg.Configuration createConfiguration()

setConfiguration

public static void setConfiguration(org.hibernate.cfg.Configuration cfg,
                                    Object lock)

resetConfiguration

public static void resetConfiguration(Object lock)

openSession

protected static org.hibernate.Session openSession()
                                            throws org.hibernate.HibernateException
Open an Hibernate Session.

Returns:
A valid Session instance, never null.
Throws:
org.hibernate.HibernateException - In case the session could not be created.

update

protected static void update(Object o)
                      throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException

save

public static void save(Object o)
                 throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException

delete

public static void delete(Object o)
                   throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException

close

protected static void close(org.hibernate.Session theHibernateSession)
Close a Hibernate Session.

Parameters:
theHibernateSession - The open session to close. In case of a problem, this method will log an error but won't propagate any exception - therefore it may be used safely in a finally{} block.

close

protected static void close(org.hibernate.Session theHibernateSession,
                            org.hibernate.Transaction tx)
Rollback a Hibernate transaction and close the session. In case of a problem, this method will log an error but won't propagate any exception - therefore it may be used safely in a finally{} block.

Parameters:
theHibernateSession - The open session to rollback and close.
tx -


Copyright © 2013. All Rights Reserved.