public class HibernateUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BATCH_SIZE |
static int |
DEFAULT_ID_SIZE |
static org.slf4j.Logger |
logger |
Constructor and Description |
---|
HibernateUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
clearSessionFactory()
Clears out the session factory so that a new one will be created for the
dbName.
|
static org.hibernate.Session |
getSession()
Returns the session for the database name specified by the
transitime.db.dbName Java property.
|
static org.hibernate.Session |
getSession(java.lang.String agencyId)
Returns session for the specified agencyId.
|
static org.hibernate.SessionFactory |
getSessionFactory(java.lang.String agencyId)
Returns a cached Hibernate SessionFactory.
|
static int |
sizeof(java.lang.Object obj)
Determines the size of a serializable object by serializing it in memory
and then measuring the resulting size in bytes.
|
public static final int BATCH_SIZE
public static final int DEFAULT_ID_SIZE
public static final org.slf4j.Logger logger
public static org.hibernate.SessionFactory getSessionFactory(java.lang.String agencyId) throws org.hibernate.HibernateException
agencyId
- Used as the database name if the property
transitime.core.dbName is not setorg.hibernate.HibernateException
public static void clearSessionFactory()
public static org.hibernate.Session getSession(java.lang.String agencyId) throws org.hibernate.HibernateException
NOTE: Make sure you close the session after the query!! Use a try/catch around the query and close the session in a finally block to make sure it happens. The system only gets a limited number of sessions!!
agencyId
- Used as the database name if the property
transitime.core.dbName is not setorg.hibernate.HibernateException
public static org.hibernate.Session getSession()
NOTE: Make sure you close the session after the query!! Use a try/catch around the query and close the session in a finally block to make sure it happens. The system only gets a limited number of sessions!!
public static int sizeof(java.lang.Object obj)
obj
- Object to be serialized