程序包 org.hibernate

接口 SessionFactory

    • 方法详细资料

      • getSessionFactoryOptions

        SessionFactoryOptions getSessionFactoryOptions()
        Get the special options used to build the factory.
        返回:
        The special options used to build the factory.
      • openStatelessSession

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

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

        Statistics getStatistics()
        Retrieve the statistics for this factory.
        返回:
        The statistics.
      • close

        void close()
            throws HibernateException
        Destroy this SessionFactory and release all resources (caches, connection pools, etc).

        It is the responsibility of the application to ensure that there are no open sessions before calling this method as the impact on those sessions is indeterminate.

        No-ops if already closed.

        指定者:
        close 在接口中 AutoCloseable
        指定者:
        close 在接口中 Closeable
        指定者:
        close 在接口中 javax.persistence.EntityManagerFactory
        抛出:
        HibernateException - Indicates an issue closing the factory.
      • isClosed

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

        Cache getCache()
        Obtain direct access to the underlying cache regions.
        指定者:
        getCache 在接口中 javax.persistence.EntityManagerFactory
        返回:
        The direct cache access API.
      • getDefinedFilterNames

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

        FilterDefinition getFilterDefinition​(String filterName)
                                      throws HibernateException
        Obtain the definition of a filter by name.
        参数:
        filterName - The name of the filter for which to obtain the definition.
        返回:
        The filter definition.
        抛出:
        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.
        参数:
        name - The name to check
        返回:
        True if there is such a fetch profile; false otherwise.
      • getClassMetadata

        @Deprecated
        ClassMetadata getClassMetadata​(Class entityClass)
        已过时。
        Use the descriptors from EntityManagerFactory.getMetamodel() instead
        Retrieve the ClassMetadata associated with the given entity class.
        参数:
        entityClass - The entity class
        返回:
        The metadata associated with the given entity; may be null if no such entity was mapped.
        抛出:
        HibernateException - Generally null is returned instead of throwing.
      • getClassMetadata

        @Deprecated
        ClassMetadata getClassMetadata​(String entityName)
        已过时。
        Use the descriptors from EntityManagerFactory.getMetamodel() instead
        Retrieve the ClassMetadata associated with the given entity class.
        参数:
        entityName - The entity class
        返回:
        The metadata associated with the given entity; may be null if no such entity was mapped.
        抛出:
        HibernateException - Generally null is returned instead of throwing.
        从以下版本开始:
        3.0
      • getCollectionMetadata

        @Deprecated
        CollectionMetadata getCollectionMetadata​(String roleName)
        已过时。
        Use the descriptors from EntityManagerFactory.getMetamodel() instead
        Get the CollectionMetadata associated with the named collection role.
        参数:
        roleName - The collection role (in form [owning-entity-name].[collection-property-name]).
        返回:
        The metadata associated with the given collection; may be null if no such collection was mapped.
        抛出:
        HibernateException - Generally null is returned instead of throwing.
      • getAllCollectionMetadata

        @Deprecated
        Map getAllCollectionMetadata()
        已过时。
        Use the descriptors from EntityManagerFactory.getMetamodel() instead
        Get the CollectionMetadata for all mapped collections.
        返回:
        a map from String to CollectionMetadata
        抛出:
        HibernateException - Generally empty map is returned instead of throwing.