org.activemath.util.db
Class HibernateHelper

java.lang.Object
  extended by org.activemath.util.db.HibernateHelper

public class HibernateHelper
extends Object

This class is a wrapper for the Hibernate SessionFactories.
It provides Sessionsto talk to hibernate, and an identifier generation method that provides unique IDs. These are generated using Hibernate's IdentifierGeneratorinterface, more specifically the TableHiLoGeneratorimplementation.


Field Summary
protected static Logger log
           
 
Method Summary
 org.hibernate.Session getAMCoreSession()
           
static HibernateHelper getInstance()
           
 org.hibernate.Session getLearnerHistorySession()
          Opens a new hibernate Session connected to the Database backend for the learner history and returns it.
 long getNextEventId()
          Returns a unique ID that can be assigned to an event.
 org.hibernate.Session getUlogSession()
          Opens a new hibernate Session connected to the Database backend for the Log DB and returns it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger log
Method Detail

getInstance

public static HibernateHelper getInstance()

getLearnerHistorySession

public org.hibernate.Session getLearnerHistorySession()
Opens a new hibernate Session connected to the Database backend for the learner history and returns it.

Don't forget to call Session.close()when you're done.

Returns:
A freshly opened Hibernate Session.

getUlogSession

public org.hibernate.Session getUlogSession()
Opens a new hibernate Session connected to the Database backend for the Log DB and returns it.

Don't forget to call Session.close()when you're done.

Returns:
A freshly opened Hibernate Session.

getAMCoreSession

public org.hibernate.Session getAMCoreSession()

getNextEventId

public long getNextEventId()
Returns a unique ID that can be assigned to an event.

Returns:
a unique id.