DJDoc v.1.0.0b-1

net.sf.djdoc.bo
Class HibernateUtils

java.lang.Object
  extended by net.sf.djdoc.bo.HibernateUtils

public class HibernateUtils
extends java.lang.Object

The HibernateUtils class is a utility class used for managing the configuration and usage of the Hibernate framework.


Method Summary
static void closeSession()
          This method closes down the current Hibernate session.
static org.hibernate.Session currentSession()
          This method retrieves the current Hibernate session.
static void delete(BusinessObject obj)
          This method deletes an existing BusinessObject from the database.
static void destroy()
          This method completely shuts down the Hibernate connection with the database.
static void save(BusinessObject obj)
          This method is used to store a BusinessObject (which may be either new or already existing) in the database.
static void setup(java.util.Properties props)
          This method is used for initializing the Hibernate framework.
static void startSession()
          This method is used to start a Hibernate session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setup

public static void setup(java.util.Properties props)
This method is used for initializing the Hibernate framework.

Parameters:
props - The Properties object holding the Hibernate configuration settings

startSession

public static void startSession()
This method is used to start a Hibernate session. Only one session may run at a time.


currentSession

public static org.hibernate.Session currentSession()
This method retrieves the current Hibernate session. If no session is currently running, a RuntimeException is thrown.

Returns:
The currently running Hibernate session.

closeSession

public static void closeSession()
This method closes down the current Hibernate session. If no session is currently running, a RuntimeException is thrown.


save

public static void save(BusinessObject obj)
This method is used to store a BusinessObject (which may be either new or already existing) in the database. It assumes that a Hibernate session is currently running.

Parameters:
obj - The BusinessObject to be saved in the database

delete

public static void delete(BusinessObject obj)
This method deletes an existing BusinessObject from the database. It assumes that a Hibernate session is already running.

Parameters:
obj - The BusinessObject to be deleted from the database

destroy

public static void destroy()
This method completely shuts down the Hibernate connection with the database. If the database is a file based HSQL database, it additionally issues a SHUTDOWN command.


DJDoc v.1.0.0b-1