Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.hibernate
Class SessionManager

java.lang.Object
  extended by org.hyperic.hq.hibernate.SessionManager

public class SessionManager
extends java.lang.Object

This class manages the creation and deletion of Hibernate sessions.


Nested Class Summary
static interface SessionManager.SessionRunner
           
 
Method Summary
static void cleanupSession(boolean flush)
          Close the current session.
static org.hibernate.Session currentSession()
           
static boolean isReadWrite()
           
static void runInSession(SessionManager.SessionRunner r)
          Run the passed runner in a session.
static void setSessionReadWrite()
          Upgrade the current running session (if there is one) to read-write
static boolean setupSession(java.lang.String dbgTxt)
          Create a session if it does not exist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

runInSession

public static void runInSession(SessionManager.SessionRunner r)
                         throws java.lang.Exception
Run the passed runner in a session. If there is no session for the current thread, one will be created for the operation and subsequently closed. If a session is already in process, no additional sessions will be created.

Throws:
java.lang.Exception

setSessionReadWrite

public static void setSessionReadWrite()
Upgrade the current running session (if there is one) to read-write


isReadWrite

public static boolean isReadWrite()

setupSession

public static boolean setupSession(java.lang.String dbgTxt)
Create a session if it does not exist.

Parameters:
dbgTxt - text to print when creating a session
Returns:
true if a session was created

cleanupSession

public static void cleanupSession(boolean flush)
Close the current session.


currentSession

public static org.hibernate.Session currentSession()

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.