Package org.hibernate

Interface SharedSessionContract

    • Method Detail

      • getTenantIdentifier

        java.lang.String getTenantIdentifier()
        Obtain the tenant identifier associated with this session.
        Returns:
        The tenant identifier associated with this session, or null
      • isOpen

        boolean isOpen()
        Check if the session is still open.
        Returns:
        boolean
      • isConnected

        boolean isConnected()
        Check if the session is currently connected.
        Returns:
        boolean
      • beginTransaction

        Transaction beginTransaction()
        Begin a unit of work and return the associated Transaction object. If a new underlying transaction is required, begin the transaction. Otherwise continue the new work in the context of the existing underlying transaction.
        Returns:
        a Transaction instance
        See Also:
        getTransaction()
      • getTransaction

        Transaction getTransaction()
        Get the Transaction instance associated with this session. The concrete type of the returned Transaction object is determined by the hibernate.transaction_factory property.
        Returns:
        a Transaction instance
      • getNamedQuery

        Query getNamedQuery​(java.lang.String queryName)
        Description copied from interface: QueryProducer
        Create a Query instance for the named query.
        Specified by:
        getNamedQuery in interface QueryProducer
        Parameters:
        queryName - the name of a pre-defined, named query
        Returns:
        The Query instance for manipulation and execution
      • getNamedProcedureCall

        ProcedureCall getNamedProcedureCall​(java.lang.String name)
        Gets a ProcedureCall based on a named template
        Parameters:
        name - The name given to the template
        Returns:
        The ProcedureCall
        See Also:
        NamedStoredProcedureQuery
      • createStoredProcedureCall

        ProcedureCall createStoredProcedureCall​(java.lang.String procedureName)
        Creates a call to a stored procedure.
        Parameters:
        procedureName - The name of the procedure.
        Returns:
        The representation of the procedure call.
      • createStoredProcedureCall

        ProcedureCall createStoredProcedureCall​(java.lang.String procedureName,
                                                java.lang.Class... resultClasses)
        Creates a call to a stored procedure with specific result set entity mappings. Each class named is considered a "root return".
        Parameters:
        procedureName - The name of the procedure.
        resultClasses - The entity(s) to map the result on to.
        Returns:
        The representation of the procedure call.
      • createStoredProcedureCall

        ProcedureCall createStoredProcedureCall​(java.lang.String procedureName,
                                                java.lang.String... resultSetMappings)
        Creates a call to a stored procedure with specific result set entity mappings.
        Parameters:
        procedureName - The name of the procedure.
        resultSetMappings - The explicit result set mapping(s) to use for mapping the results
        Returns:
        The representation of the procedure call.
      • createCriteria

        @Deprecated
        Criteria createCriteria​(java.lang.Class persistentClass)
        Deprecated.
        (since 5.2) for Session, use the JPA Criteria
        Create Criteria instance for the given class (entity or subclasses/implementors).
        Parameters:
        persistentClass - The class, which is an entity, or has entity subclasses/implementors
        Returns:
        The criteria instance for manipulation and execution
      • createCriteria

        @Deprecated
        Criteria createCriteria​(java.lang.Class persistentClass,
                                java.lang.String alias)
        Deprecated.
        (since 5.2) for Session, use the JPA Criteria
        Create Criteria instance for the given class (entity or subclasses/implementors), using a specific alias.
        Parameters:
        persistentClass - The class, which is an entity, or has entity subclasses/implementors
        alias - The alias to use
        Returns:
        The criteria instance for manipulation and execution
      • createCriteria

        @Deprecated
        Criteria createCriteria​(java.lang.String entityName)
        Deprecated.
        (since 5.2) for Session, use the JPA Criteria
        Create Criteria instance for the given entity name.
        Parameters:
        entityName - The entity name
        Returns:
        The criteria instance for manipulation and execution
      • createCriteria

        @Deprecated
        Criteria createCriteria​(java.lang.String entityName,
                                java.lang.String alias)
        Deprecated.
        (since 5.2) for Session, use the JPA Criteria
        Create Criteria instance for the given entity name, using a specific alias.
        Parameters:
        entityName - The entity name
        alias - The alias to use
        Returns:
        The criteria instance for manipulation and execution
      • setJdbcBatchSize

        void setJdbcBatchSize​(java.lang.Integer jdbcBatchSize)
        Set the Session-level JDBC batch size. Overrides the SessionFactory JDBC batch size defined by the hibernate.default_batch_fetch_size configuration property for the scope of the current Session.
        Parameters:
        jdbcBatchSize - Session-level JDBC batch size
        Since:
        5.2
        See Also:
        SessionFactoryOptions.getJdbcBatchSize(), SessionFactoryBuilder.applyJdbcBatchSize(int)
      • doWork

        default void doWork​(Work work)
                     throws HibernateException
        Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
        Parameters:
        work - The work to be performed.
        Throws:
        HibernateException - Generally indicates wrapped SQLException