Class HibernateUtil


  • public class HibernateUtil
    extends java.lang.Object
    A utility class for using hibernate.
    Since:
    4.0.5
    Version:
    $Revision: 26035 $ $Date: 2023-11-30 14:49:12 -0300 (Thu, 30 Nov 2023) $
    • Constructor Summary

      Constructors 
      Constructor Description
      HibernateUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static EntityManagerFactory createEntityManagerFactory​(java.lang.String databaseId, java.net.URL configURL, java.util.Collection<java.lang.String> entities)
      Creates an entity manager factory.
      static org.hibernate.type.NullableType dataTypeToHibernateType​(java.lang.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​(java.lang.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​(java.lang.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 java.util.List<java.lang.Exception> rebuildEntityManagerFactoriesIfNeeded()
      Rebuilds the entity manager factories if needed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HIBERNATE_CONFIG_RESOURCE_NAME

        public static final java.lang.String HIBERNATE_CONFIG_RESOURCE_NAME
        Name that must be given to Ejb3Configuration.configure(String).
        Since:
        7.1.0
        See Also:
        Constant Field Values
      • SYSTEM_PROPERTY_DISABLE_READJUST_CACHE_CAPACITY

        public static final java.lang.String SYSTEM_PROPERTY_DISABLE_READJUST_CACHE_CAPACITY
        System property for internal use that disables the readjust cache capacity phase during initialization.
        Since:
        9.0.0
        See Also:
        Constant Field Values
    • 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.
      • createEntityManagerFactory

        public static EntityManagerFactory createEntityManagerFactory​(java.lang.String databaseId,
                                                                      java.net.URL configURL,
                                                                      java.util.Collection<java.lang.String> entities)
        Creates an entity manager factory.
        Parameters:
        databaseId - the detabase id.
        configURL - the configuration URL.
        entities - the entities that will be adde to the factory.
        Returns:
        the created factory.
        Since:
        7.1.0
      • getEntityManagerFactory

        public static EntityManagerFactory getEntityManagerFactory​(java.lang.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​(java.lang.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​(java.lang.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()