Class HibernateUtil


  • public class HibernateUtil
    extends Object
    A utility class for using hibernate.
    Since:
    4.0.5
    Version:
    $Revision: 24658 $ $Date: 2021-08-13 10:26:41 -0300 (Fri, 13 Aug 2021) $
    • Field Detail

      • HIBERNATE_CONFIG_RESOURCE_NAME

        public static final 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 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​(String databaseId,
                                                                      URL configURL,
                                                                      Collection<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​(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()