lumis.portal.dao.hibernate
Class HibernateUtil

Package class diagram package HibernateUtil
java.lang.Object
  extended by lumis.portal.dao.hibernate.HibernateUtil

public class HibernateUtil
extends Object

A utility class for using hibernate.

Since:
4.0.5

Constructor Summary
HibernateUtil()
           
 
Method Summary
static org.hibernate.type.NullableType dataTypeToHibernateType(String dataType)
          Returns the hibernate type to be used to read/write to the given lumis field data type.
static void destroy()
           
static EntityManagerFactory getEntityManagerFactory()
          Returns the default entity manager factory, that access the portal's main database.
static EntityManagerFactory getEntityManagerFactory(String databaseId)
          Returns the entity manager factory associated with the given id.
static org.hibernate.SessionFactory getSessionFactory()
          Returns the default session factory, that access the portal's main database.
static org.hibernate.SessionFactory getSessionFactory(String databaseId)
          Returns the session factory associated with the given id.
static void init()
           
static boolean isInitialized()
          Indicates if the portal's hibernate infra-structure has been initialized.
static EntityManagerFactory registerEntityManagerFactory(String databaseId, URL configurationURL)
          Registers an EntityManagerFactory, based on an hibernate configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtil

public HibernateUtil()
Method Detail

getEntityManagerFactory

public static EntityManagerFactory getEntityManagerFactory()
Returns the default entity manager factory, that access the portal's main database.

Returns:
the entity manager factory.
Since:
4.2.0

getSessionFactory

public static org.hibernate.SessionFactory getSessionFactory()
Returns the default session factory, that access the portal's main database.

Returns:
the session factory.

registerEntityManagerFactory

public static EntityManagerFactory registerEntityManagerFactory(String databaseId,
                                                                URL configurationURL)
Registers an EntityManagerFactory, based on an hibernate configuration.

The registered EntityManagerFactory will be available in getEntityManagerFactory(String) using the same databaseId value. The respective SessionFactory will also be available in getSessionFactory(String) using the same databaseId value.

Parameters:
databaseId - the database identifier used as a key for the EntityManagerFactory being registered.
configurationURL - the URL for the hibernate configuration.
Returns:
the registered EntityManagerFactory instance.
Since:
4.2.0

getEntityManagerFactory

public static EntityManagerFactory getEntityManagerFactory(String databaseId)
Returns the entity manager factory associated with the given id.

Parameters:
databaseId - the id that identifies the database.
Returns:
the entity manager factory.
Since:
4.2.0

getSessionFactory

public static org.hibernate.SessionFactory getSessionFactory(String databaseId)
Returns the session factory associated with the given id.

Parameters:
databaseId - the id that identifies the database the session factory accesses.
Returns:
the session factory.
Since:
4.0.4

dataTypeToHibernateType

public static org.hibernate.type.NullableType dataTypeToHibernateType(String dataType)
Returns the hibernate type to be used to read/write to the given lumis field data type.

Parameters:
dataType - the lumis field data type.
Returns:
the hibernate type, or null if an appropriate hibernate type was not found.

isInitialized

public static boolean isInitialized()
Indicates if the portal's hibernate infra-structure has been initialized.

Returns:
true if initialized, false otherwise.
Since:
4.0.11

init

public static void init()

destroy

public static void destroy()


Lumisportal  5.5.0.091130 - Copyright © 2001-2007, Lumis. All Rights Reserved.