public class HibernateUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HIBERNATE_CONFIG_RESOURCE_NAME
Name that must be given to
Ejb3Configuration.configure(String) . |
static String |
SYSTEM_PROPERTY_DISABLE_READJUST_CACHE_CAPACITY
System property for internal use that disables the readjust cache capacity phase during initialization.
|
Constructor and Description |
---|
HibernateUtil() |
Modifier and Type | Method and Description |
---|---|
static EntityManagerFactory |
createEntityManagerFactory(String databaseId,
URL configURL,
Collection<String> entities)
Creates an entity manager factory.
|
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 List<Exception> |
rebuildEntityManagerFactoriesIfNeeded()
Rebuilds the entity manager factories if needed.
|
public static final String HIBERNATE_CONFIG_RESOURCE_NAME
Ejb3Configuration.configure(String)
.public static final String SYSTEM_PROPERTY_DISABLE_READJUST_CACHE_CAPACITY
public static EntityManagerFactory getEntityManagerFactory()
public static org.hibernate.SessionFactory getSessionFactory()
public static EntityManagerFactory createEntityManagerFactory(String databaseId, URL configURL, Collection<String> entities)
databaseId
- the detabase id.configURL
- the configuration URL.entities
- the entities that will be adde to the factory.public static EntityManagerFactory getEntityManagerFactory(String databaseId)
databaseId
- the id that identifies the database.public static org.hibernate.SessionFactory getSessionFactory(String databaseId)
databaseId
- the id that identifies the database the session factory
accesses.public static org.hibernate.type.NullableType dataTypeToHibernateType(String dataType)
dataType
- the lumis field data type.public static boolean isInitialized()
true
if initialized, false
otherwise.public static void init()
public static void destroy()
public static List<Exception> rebuildEntityManagerFactoriesIfNeeded() throws PortalException, EntityManagerFactoryAlreadyBeingRebuiltException, EntityManagerFactoryLockedForBeingRebuiltException, EntityManagerFactoryRebuildTimeoutException
EntityManagerFactoryRebuildTimeoutException
- if a rebuild lock couldn't be obtained.EntityManagerFactoryLockedForBeingRebuiltException
- if a factory is already locked for rebuilt.EntityManagerFactoryAlreadyBeingRebuiltException
- if a factory is already being rebuilt.PortalException
LumisXP 12.0.0.190809 - Copyright © 2006–2019 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.