public class HibernateUtilities
extends java.lang.Object
null, a 'defaultFactory' will be used.DEFAULT_SESSION_FACTORY_ID| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DB_SERVICE_REGISTRATION_ERROR |
static java.lang.String |
DEFAULT_SESSION_FACTORY_ID |
| Constructor and Description |
|---|
HibernateUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeSessionFactory(java.lang.String factoryID)
Close session factory specified by the factory ID.
|
static HibernateDatabaseService |
getDatabaseService(java.lang.String databaseSystemName)
Returns the
HibernateDatabaseService for the specified database system. |
static java.util.List<java.lang.String> |
getDatabaseSystemList()
Returns a sorted list of known/available database systems that are registered at the
HibernateUtilities. |
static org.hibernate.SessionFactory |
getSessionFactory()
Will return the default session factory.
|
static org.hibernate.SessionFactory |
getSessionFactory(org.hibernate.cfg.Configuration configuration)
Will return or create the default session factory.
|
static org.hibernate.SessionFactory |
getSessionFactory(java.lang.String factoryID)
Gets the session factory with the specified ID.
|
static org.hibernate.SessionFactory |
getSessionFactory(java.lang.String factoryID,
org.hibernate.cfg.Configuration configuration)
Returns the hibernate session factory.
|
static org.hibernate.SessionFactory |
getSessionFactory(java.lang.String factoryID,
org.hibernate.cfg.Configuration configuration,
boolean isResetSessionFactory,
boolean doSilentConnectionCheck)
Returns the hibernate session factory.
|
static SessionFactoryMonitor |
getSessionFactoryMonitor(java.lang.String factoryID)
Returns the session factory monitor for the specified factory defined by its ID.
|
static boolean |
isSessionFactoryInCreation(SessionFactoryMonitor sessionFactoryMonitor)
Checks if a session factory is in creation.
|
static boolean |
isSessionFactoryInCreation(java.lang.String factoryID)
Checks if is session factory in creation.
|
static void |
registerDatabaseService(HibernateDatabaseService databaseService)
Registers a
HibernateDatabaseService. |
static void |
setStatisticsEnabled(java.lang.String factoryID,
boolean setEnabled)
Sets the statistics for the specified SessionFactory enabled (or not).
|
static void |
unregisterDatabaseService(HibernateDatabaseService databaseService)
Unregisters a
HibernateDatabaseService. |
static void |
waitForSessionFactoryCreation()
Calling this method, the invoking thread will be paused until all session factory
start-ups (successful or not) are finalized. - The maximum wait time is 30s.
|
static void |
writeStatistics(java.lang.String factoryID)
Write the SessionFactory statistics for the specified factory.
|
public static final java.lang.String DEFAULT_SESSION_FACTORY_ID
public static final java.lang.String DB_SERVICE_REGISTRATION_ERROR
public static SessionFactoryMonitor getSessionFactoryMonitor(java.lang.String factoryID)
factoryID - the factory ID (null will use the default factory)DEFAULT_SESSION_FACTORY_IDpublic static void waitForSessionFactoryCreation()
public static boolean isSessionFactoryInCreation(java.lang.String factoryID)
factoryID - the factory ID (null will use the default factory)public static boolean isSessionFactoryInCreation(SessionFactoryMonitor sessionFactoryMonitor)
sessionFactoryMonitor - the session factory monitorpublic static org.hibernate.SessionFactory getSessionFactory()
public static org.hibernate.SessionFactory getSessionFactory(org.hibernate.cfg.Configuration configuration)
public static org.hibernate.SessionFactory getSessionFactory(java.lang.String factoryID)
factoryID - the factory ID (null will use the default factory)public static org.hibernate.SessionFactory getSessionFactory(java.lang.String factoryID,
org.hibernate.cfg.Configuration configuration)
factoryID - the factory ID (null will use the default factory)configuration - the configurationpublic static org.hibernate.SessionFactory getSessionFactory(java.lang.String factoryID,
org.hibernate.cfg.Configuration configuration,
boolean isResetSessionFactory,
boolean doSilentConnectionCheck)
factoryID - the factory ID (null will use the default factory)configuration - the hibernate configuration objectisResetSessionFactory - the is reset session factorydoSilentConnectionCheck - set true, the do a silent connection checkDEFAULT_SESSION_FACTORY_IDpublic static void setStatisticsEnabled(java.lang.String factoryID,
boolean setEnabled)
factoryID - the factory IDsetEnabled - the set enabledpublic static void writeStatistics(java.lang.String factoryID)
factoryID - the factory IDpublic static void closeSessionFactory(java.lang.String factoryID)
factoryID - the factory ID (null will use the default factory)public static void registerDatabaseService(HibernateDatabaseService databaseService)
HibernateDatabaseService.databaseService - the database servicepublic static void unregisterDatabaseService(HibernateDatabaseService databaseService)
HibernateDatabaseService.databaseService - the database servicepublic static java.util.List<java.lang.String> getDatabaseSystemList()
HibernateUtilities.public static HibernateDatabaseService getDatabaseService(java.lang.String databaseSystemName)
HibernateDatabaseService for the specified database system.databaseSystemName - the database system name