Package org.hibernate

Interface SessionFactory

    • Method Detail

      • getSessionFactoryOptions

        SessionFactoryOptions getSessionFactoryOptions()
        Get the special options used to build the factory.
        Returns:
        The special options used to build the factory.
      • getCurrentSession

        Session getCurrentSession()
                           throws HibernateException
        Obtains the current session. The definition of what exactly "current" means controlled by the CurrentSessionContext impl configured for use.

        Note that for backwards compatibility, if a CurrentSessionContext is not configured but JTA is configured this will default to the JTASessionContext impl.

        Returns:
        The current session.
        Throws:
        HibernateException - Indicates an issue locating a suitable current session.
      • openStatelessSession

        StatelessSession openStatelessSession()
        Open a new stateless session.
        Returns:
        The created stateless session.
      • openStatelessSession

        StatelessSession openStatelessSession​(Connection connection)
        Open a new stateless session, utilizing the specified JDBC Connection.
        Parameters:
        connection - Connection provided by the application.
        Returns:
        The created stateless session.
      • getStatistics

        Statistics getStatistics()
        Retrieve the statistics for this factory.
        Returns:
        The statistics.
      • isClosed

        boolean isClosed()
        Is this factory already closed?
        Returns:
        True if this factory is already closed; false otherwise.
      • getCache

        Cache getCache()
        Obtain direct access to the underlying cache regions.
        Specified by:
        getCache in interface EntityManagerFactory
        Returns:
        The direct cache access API.
      • getDefinedFilterNames

        Set getDefinedFilterNames()
        Obtain a set of the names of all filters defined on this SessionFactory.
        Returns:
        The set of filter names.
      • getFilterDefinition

        FilterDefinition getFilterDefinition​(String filterName)
                                      throws HibernateException
        Obtain the definition of a filter by name.
        Parameters:
        filterName - The name of the filter for which to obtain the definition.
        Returns:
        The filter definition.
        Throws:
        HibernateException - If no filter defined with the given name.
      • containsFetchProfileDefinition

        boolean containsFetchProfileDefinition​(String name)
        Determine if this session factory contains a fetch profile definition registered under the given name.
        Parameters:
        name - The name to check
        Returns:
        True if there is such a fetch profile; false otherwise.
      • getCollectionMetadata

        @Deprecated
        CollectionMetadata getCollectionMetadata​(String roleName)
        Deprecated.
        Use the descriptors from EntityManagerFactory.getMetamodel() instead
        Get the CollectionMetadata associated with the named collection role.
        Parameters:
        roleName - The collection role (in form [owning-entity-name].[collection-property-name]).
        Returns:
        The metadata associated with the given collection; may be null if no such collection was mapped.
        Throws:
        HibernateException - Generally null is returned instead of throwing.