Class SessionLazyDelegator

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Serializable, java.lang.AutoCloseable, EntityManager, HibernateEntityManager, QueryProducer, Session, SharedSessionContract

    public class SessionLazyDelegator
    extends java.lang.Object
    implements Session
    This helper class allows decorating a Session instance, while the instance itself is lazily provided via a Supplier. When the decorated instance is readily available, one should prefer using SessionDelegatorBaseImpl. Another difference with SessionDelegatorBaseImpl is that this type only implements Session.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionLazyDelegator​(java.util.function.Supplier<Session> lazySessionLookup)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addEventListeners​(SessionEventListener... listeners)
      Add one or more listeners to the Session
      Transaction beginTransaction()
      Begin a unit of work and return the associated Transaction object.
      Session.LockRequest buildLockRequest​(LockOptions lockOptions)
      Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.
      <T> IdentifierLoadAccess<T> byId​(java.lang.Class<T> entityClass)
      Create an IdentifierLoadAccess instance to retrieve the specified entity by primary key.
      IdentifierLoadAccess byId​(java.lang.String entityName)
      Create an IdentifierLoadAccess instance to retrieve the specified entity type by primary key.
      <T> MultiIdentifierLoadAccess<T> byMultipleIds​(java.lang.Class<T> entityClass)
      Create a MultiIdentifierLoadAccess instance to retrieve multiple entities at once as specified by primary key values.
      MultiIdentifierLoadAccess byMultipleIds​(java.lang.String entityName)
      Create a MultiIdentifierLoadAccess instance to retrieve multiple entities at once as specified by primary key values.
      <T> NaturalIdLoadAccess<T> byNaturalId​(java.lang.Class<T> entityClass)
      Create a NaturalIdLoadAccess instance to retrieve the specified entity by its natural id.
      NaturalIdLoadAccess byNaturalId​(java.lang.String entityName)
      Create a NaturalIdLoadAccess instance to retrieve the specified entity by its natural id.
      <T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId​(java.lang.Class<T> entityClass)
      Create a SimpleNaturalIdLoadAccess instance to retrieve the specified entity by its simple (single attribute) natural id.
      SimpleNaturalIdLoadAccess bySimpleNaturalId​(java.lang.String entityName)
      Create a SimpleNaturalIdLoadAccess instance to retrieve the specified entity by its natural id.
      void cancelQuery()
      Cancel the execution of the current query.
      void clear()
      Completely clear the session.
      void close()
      End the session by releasing the JDBC connection and cleaning up.
      boolean contains​(java.lang.Object entity)  
      boolean contains​(java.lang.String entityName, java.lang.Object object)
      Check if this entity is associated with this Session.
      Criteria createCriteria​(java.lang.Class persistentClass)
      Deprecated.
      Criteria createCriteria​(java.lang.Class persistentClass, java.lang.String alias)
      Deprecated.
      Criteria createCriteria​(java.lang.String entityName)
      Deprecated.
      Criteria createCriteria​(java.lang.String entityName, java.lang.String alias)
      Deprecated.
      <T> RootGraph<T> createEntityGraph​(java.lang.Class<T> rootType)  
      RootGraph<?> createEntityGraph​(java.lang.String graphName)  
      Query createFilter​(java.lang.Object collection, java.lang.String queryString)
      Deprecated.
      Query createNamedQuery​(java.lang.String name)
      The JPA-defined named query creation method.
      <T> Query<T> createNamedQuery​(java.lang.String name, java.lang.Class<T> resultType)
      The JPA-defined named, typed query creation method.
      StoredProcedureQuery createNamedStoredProcedureQuery​(java.lang.String name)  
      NativeQuery createNativeQuery​(java.lang.String sqlString)
      Create a NativeQuery instance for the given native (SQL) query
      NativeQuery createNativeQuery​(java.lang.String sqlString, java.lang.Class resultClass)
      Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.
      NativeQuery createNativeQuery​(java.lang.String sqlString, java.lang.String resultSetMapping)
      Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.
      Query createQuery​(java.lang.String queryString)
      Create a Query instance for the given HQL/JPQL query string.
      <T> Query<T> createQuery​(java.lang.String queryString, java.lang.Class<T> resultType)
      Create a typed Query instance for the given HQL/JPQL query string.
      Query createQuery​(CriteriaDelete deleteQuery)  
      <T> Query<T> createQuery​(CriteriaQuery<T> criteriaQuery)  
      Query createQuery​(CriteriaUpdate updateQuery)  
      NativeQuery createSQLQuery​(java.lang.String queryString)
      Create a NativeQuery instance for the given SQL query string.
      ProcedureCall createStoredProcedureCall​(java.lang.String procedureName)
      Creates a call to a stored procedure.
      ProcedureCall createStoredProcedureCall​(java.lang.String procedureName, java.lang.Class... resultClasses)
      Creates a call to a stored procedure with specific result set entity mappings.
      ProcedureCall createStoredProcedureCall​(java.lang.String procedureName, java.lang.String... resultSetMappings)
      Creates a call to a stored procedure with specific result set entity mappings.
      StoredProcedureQuery createStoredProcedureQuery​(java.lang.String procedureName)  
      StoredProcedureQuery createStoredProcedureQuery​(java.lang.String procedureName, java.lang.Class... resultClasses)  
      StoredProcedureQuery createStoredProcedureQuery​(java.lang.String procedureName, java.lang.String... resultSetMappings)  
      void delete​(java.lang.Object object)
      Remove a persistent instance from the datastore.
      void delete​(java.lang.String entityName, java.lang.Object object)
      Remove a persistent instance from the datastore.
      void detach​(java.lang.Object entity)  
      void disableFetchProfile​(java.lang.String name)
      Disable a particular fetch profile on this session.
      void disableFilter​(java.lang.String filterName)
      Disable the named filter for the current session.
      java.sql.Connection disconnect()
      Disconnect the session from its underlying JDBC connection.
      <T> T doReturningWork​(ReturningWork<T> work)
      Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
      void doWork​(Work work)
      Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
      void enableFetchProfile​(java.lang.String name)
      Enable a particular fetch profile on this session.
      Filter enableFilter​(java.lang.String filterName)
      Enable the named filter for this current session.
      void evict​(java.lang.Object object)
      Remove this instance from the session cache.
      <T> T find​(java.lang.Class<T> entityClass, java.lang.Object primaryKey)  
      <T> T find​(java.lang.Class<T> entityClass, java.lang.Object primaryKey, java.util.Map<java.lang.String,​java.lang.Object> properties)  
      <T> T find​(java.lang.Class<T> entityClass, java.lang.Object primaryKey, LockModeType lockMode)  
      <T> T find​(java.lang.Class<T> entityClass, java.lang.Object primaryKey, LockModeType lockMode, java.util.Map<java.lang.String,​java.lang.Object> properties)  
      void flush()
      Force this session to flush.
      <T> T get​(java.lang.Class<T> entityType, java.io.Serializable id)
      Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
      <T> T get​(java.lang.Class<T> entityType, java.io.Serializable id, LockMode lockMode)
      Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
      <T> T get​(java.lang.Class<T> entityType, java.io.Serializable id, LockOptions lockOptions)
      Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
      java.lang.Object get​(java.lang.String entityName, java.io.Serializable id)
      Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance.
      java.lang.Object get​(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
      Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
      java.lang.Object get​(java.lang.String entityName, java.io.Serializable id, LockOptions lockOptions)
      Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
      CacheMode getCacheMode()
      Get the current cache mode.
      CriteriaBuilder getCriteriaBuilder()  
      LockMode getCurrentLockMode​(java.lang.Object object)
      Determine the current lock mode of the given object.
      java.lang.Object getDelegate()  
      Filter getEnabledFilter​(java.lang.String filterName)
      Retrieve a currently enabled filter by name.
      RootGraph<?> getEntityGraph​(java.lang.String graphName)  
      <T> java.util.List<EntityGraph<? super T>> getEntityGraphs​(java.lang.Class<T> entityClass)  
      EntityManagerFactory getEntityManagerFactory()  
      java.lang.String getEntityName​(java.lang.Object object)
      Return the entity name for a persistent entity.
      FlushModeType getFlushMode()
      FlushMode getHibernateFlushMode()
      Get the current flush mode for this session.
      java.io.Serializable getIdentifier​(java.lang.Object object)
      Return the identifier value of the given entity as associated with this session.
      java.lang.Integer getJdbcBatchSize()
      Get the Session-level JDBC batch size for the current Session.
      LobHelper getLobHelper()
      Retrieve this session's helper/delegate for creating LOB instances.
      LockModeType getLockMode​(java.lang.Object entity)  
      Metamodel getMetamodel()  
      NativeQuery getNamedNativeQuery​(java.lang.String name)
      Get a NativeQuery instance for a named native SQL query
      ProcedureCall getNamedProcedureCall​(java.lang.String name)
      Gets a ProcedureCall based on a named template
      Query getNamedQuery​(java.lang.String queryName)
      Create a Query instance for the named query.
      Query getNamedSQLQuery​(java.lang.String name)
      Deprecated.
      java.util.Map<java.lang.String,​java.lang.Object> getProperties()  
      <T> T getReference​(java.lang.Class<T> entityClass, java.lang.Object primaryKey)  
      <T> T getReference​(T object)
      Return a reference to the persistent instance with the same identity as the given instance, which might be detached, making the assumption that the instance is still persistent in the database.
      Session getSession()
      Retrieve a reference to the Hibernate Session used by this EntityManager.
      SessionFactory getSessionFactory()
      Get the session factory which created this session.
      SessionStatistics getStatistics()
      Get the statistics for this session.
      java.lang.String getTenantIdentifier()
      Obtain the tenant identifier associated with this session.
      Transaction getTransaction()
      Get the Transaction instance associated with this session.
      TypeHelper getTypeHelper()
      Convenience access to the TypeHelper associated with this session's SessionFactory.
      boolean isConnected()
      Check if the session is currently connected.
      boolean isDefaultReadOnly()
      Will entities and proxies that are loaded into this session be made read-only by default? To determine the read-only/modifiable setting for a particular entity or proxy:
      boolean isDirty()
      Does this session contain any changes which must be synchronized with the database? In other words, would any DML operations be executed if we flushed this session?
      boolean isFetchProfileEnabled​(java.lang.String name)
      Is a particular fetch profile enabled on this session?
      boolean isJoinedToTransaction()  
      boolean isOpen()
      Check if the session is still open.
      boolean isReadOnly​(java.lang.Object entityOrProxy)
      Is the specified entity or proxy read-only? To get the default read-only/modifiable setting used for entities and proxies that are loaded into the session:
      void joinTransaction()  
      <T> T load​(java.lang.Class<T> theClass, java.io.Serializable id)
      Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
      <T> T load​(java.lang.Class<T> theClass, java.io.Serializable id, LockMode lockMode)
      Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
      <T> T load​(java.lang.Class<T> theClass, java.io.Serializable id, LockOptions lockOptions)
      Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
      void load​(java.lang.Object object, java.io.Serializable id)
      Read the persistent state associated with the given identifier into the given transient instance.
      java.lang.Object load​(java.lang.String entityName, java.io.Serializable id)
      Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
      java.lang.Object load​(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
      Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
      java.lang.Object load​(java.lang.String entityName, java.io.Serializable id, LockOptions lockOptions)
      Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
      void lock​(java.lang.Object entity, LockModeType lockMode)  
      void lock​(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,​java.lang.Object> properties)  
      void lock​(java.lang.Object object, LockMode lockMode)
      Obtain the specified lock level upon the given object.
      void lock​(java.lang.String entityName, java.lang.Object object, LockMode lockMode)
      Obtain the specified lock level upon the given object.
      java.lang.Object merge​(java.lang.Object object)
      Copy the state of the given object onto the persistent object with the same identifier.
      java.lang.Object merge​(java.lang.String entityName, java.lang.Object object)
      Copy the state of the given object onto the persistent object with the same identifier.
      void persist​(java.lang.Object object)
      Make a transient instance persistent.
      void persist​(java.lang.String entityName, java.lang.Object object)
      Make a transient instance persistent.
      void reconnect​(java.sql.Connection connection)
      Reconnect to the given JDBC connection.
      void refresh​(java.lang.Object object)
      Re-read the state of the given instance from the underlying database.
      void refresh​(java.lang.Object entity, java.util.Map<java.lang.String,​java.lang.Object> properties)  
      void refresh​(java.lang.Object entity, LockModeType lockMode)  
      void refresh​(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,​java.lang.Object> properties)  
      void refresh​(java.lang.Object object, LockMode lockMode)
      Re-read the state of the given instance from the underlying database, with the given LockMode.
      void refresh​(java.lang.Object object, LockOptions lockOptions)
      Re-read the state of the given instance from the underlying database, with the given LockMode.
      void refresh​(java.lang.String entityName, java.lang.Object object)
      Re-read the state of the given instance from the underlying database.
      void refresh​(java.lang.String entityName, java.lang.Object object, LockOptions lockOptions)
      Re-read the state of the given instance from the underlying database, with the given LockMode.
      void remove​(java.lang.Object entity)  
      void replicate​(java.lang.Object object, ReplicationMode replicationMode)
      Persist the state of the given detached instance, reusing the current identifier value.
      void replicate​(java.lang.String entityName, java.lang.Object object, ReplicationMode replicationMode)
      Persist the state of the given detached instance, reusing the current identifier value.
      java.io.Serializable save​(java.lang.Object object)
      Persist the given transient instance, first assigning a generated identifier.
      java.io.Serializable save​(java.lang.String entityName, java.lang.Object object)
      Persist the given transient instance, first assigning a generated identifier.
      void saveOrUpdate​(java.lang.Object object)
      Either Session.save(Object) or Session.update(Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).
      void saveOrUpdate​(java.lang.String entityName, java.lang.Object object)
      Either Session.save(String, Object) or Session.update(String, Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).
      SharedSessionBuilder sessionWithOptions()
      Obtain a Session builder with the ability to grab certain information from this session.
      void setCacheMode​(CacheMode cacheMode)
      Set the cache mode.
      void setDefaultReadOnly​(boolean readOnly)
      Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode.
      void setFlushMode​(FlushModeType flushMode)  
      void setFlushMode​(FlushMode flushMode)
      Deprecated.
      void setHibernateFlushMode​(FlushMode flushMode)
      Set the flush mode for this session.
      void setJdbcBatchSize​(java.lang.Integer jdbcBatchSize)
      Set the Session-level JDBC batch size.
      void setProperty​(java.lang.String propertyName, java.lang.Object value)  
      void setReadOnly​(java.lang.Object entityOrProxy, boolean readOnly)
      Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode.
      <T> T unwrap​(java.lang.Class<T> cls)  
      void update​(java.lang.Object object)
      Update the persistent instance with the identifier of the given detached instance.
      void update​(java.lang.String entityName, java.lang.Object object)
      Update the persistent instance with the identifier of the given detached instance.
      • Methods inherited from class java.lang.Object

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

      • SessionLazyDelegator

        public SessionLazyDelegator​(java.util.function.Supplier<Session> lazySessionLookup)
    • Method Detail

      • setFlushMode

        @Deprecated
        public void setFlushMode​(FlushMode flushMode)
        Deprecated.
        Description copied from interface: Session
        Set the flush mode for this session.

        The flush mode determines the points at which the session is flushed. Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.

        For a logically "read only" session, it is reasonable to set the session's flush mode to FlushMode.MANUAL at the start of the session (in order to achieve some extra performance).

        Specified by:
        setFlushMode in interface Session
        Parameters:
        flushMode - the new flush mode
      • setHibernateFlushMode

        public void setHibernateFlushMode​(FlushMode flushMode)
        Description copied from interface: Session
        Set the flush mode for this session.

        The flush mode determines the points at which the session is flushed. Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.

        For a logically "read only" session, it is reasonable to set the session's flush mode to FlushMode.MANUAL at the start of the session (in order to achieve some extra performance).

        Specified by:
        setHibernateFlushMode in interface Session
        Parameters:
        flushMode - the new flush mode
      • getHibernateFlushMode

        public FlushMode getHibernateFlushMode()
        Description copied from interface: Session
        Get the current flush mode for this session.
        Specified by:
        getHibernateFlushMode in interface Session
        Returns:
        The flush mode
      • setCacheMode

        public void setCacheMode​(CacheMode cacheMode)
        Description copied from interface: Session
        Set the cache mode.

        Cache mode determines the manner in which this session can interact with the second level cache.

        Specified by:
        setCacheMode in interface Session
        Parameters:
        cacheMode - The new cache mode.
      • getCacheMode

        public CacheMode getCacheMode()
        Description copied from interface: Session
        Get the current cache mode.
        Specified by:
        getCacheMode in interface Session
        Returns:
        The current cache mode.
      • cancelQuery

        public void cancelQuery()
                         throws HibernateException
        Description copied from interface: Session
        Cancel the execution of the current query.

        This is the sole method on session which may be safely called from another thread.

        Specified by:
        cancelQuery in interface Session
        Throws:
        HibernateException - There was a problem canceling the query
      • isDirty

        public boolean isDirty()
                        throws HibernateException
        Description copied from interface: Session
        Does this session contain any changes which must be synchronized with the database? In other words, would any DML operations be executed if we flushed this session?
        Specified by:
        isDirty in interface Session
        Returns:
        True if the session contains pending changes; false otherwise.
        Throws:
        HibernateException - could not perform dirtying checking
      • isDefaultReadOnly

        public boolean isDefaultReadOnly()
        Description copied from interface: Session
        Will entities and proxies that are loaded into this session be made read-only by default? To determine the read-only/modifiable setting for a particular entity or proxy:
        Specified by:
        isDefaultReadOnly in interface Session
        Returns:
        true, loaded entities/proxies will be made read-only by default; false, loaded entities/proxies will be made modifiable by default.
        See Also:
        Session.isReadOnly(Object)
      • setDefaultReadOnly

        public void setDefaultReadOnly​(boolean readOnly)
        Description copied from interface: Session
        Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode. Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted. When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting. To change the read-only/modifiable setting for a particular entity or proxy that is already in this session:
        Specified by:
        setDefaultReadOnly in interface Session
        Parameters:
        readOnly - true, the default for loaded entities/proxies is read-only; false, the default for loaded entities/proxies is modifiable
        See Also:
        To override this session's read-only/modifiable setting for entities and proxies loaded by a Query:, Query.setReadOnly(boolean)
      • getIdentifier

        public java.io.Serializable getIdentifier​(java.lang.Object object)
        Description copied from interface: Session
        Return the identifier value of the given entity as associated with this session. An exception is thrown if the given entity instance is transient or detached in relation to this session.
        Specified by:
        getIdentifier in interface Session
        Parameters:
        object - a persistent instance
        Returns:
        the identifier
      • contains

        public boolean contains​(java.lang.String entityName,
                                java.lang.Object object)
        Description copied from interface: Session
        Check if this entity is associated with this Session. This form caters to non-POJO entities, by allowing the entity-name to be passed in
        Specified by:
        contains in interface Session
        Parameters:
        entityName - The entity name
        object - an instance of a persistent class
        Returns:
        true if the given instance is associated with this Session
      • evict

        public void evict​(java.lang.Object object)
        Description copied from interface: Session
        Remove this instance from the session cache. Changes to the instance will not be synchronized with the database. This operation cascades to associated instances if the association is mapped with cascade="evict".
        Specified by:
        evict in interface Session
        Parameters:
        object - The entity to evict
      • load

        public <T> T load​(java.lang.Class<T> theClass,
                          java.io.Serializable id,
                          LockMode lockMode)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.

        Convenient form of Session.load(Class, Serializable, LockOptions)

        Specified by:
        load in interface Session
        Parameters:
        theClass - a persistent class
        id - a valid identifier of an existing persistent instance of the class
        lockMode - the lock level
        Returns:
        the persistent instance or proxy
        See Also:
        Session.load(Class, Serializable, LockOptions)
      • load

        public <T> T load​(java.lang.Class<T> theClass,
                          java.io.Serializable id,
                          LockOptions lockOptions)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
        Specified by:
        load in interface Session
        Parameters:
        theClass - a persistent class
        id - a valid identifier of an existing persistent instance of the class
        lockOptions - contains the lock level
        Returns:
        the persistent instance or proxy
      • load

        public java.lang.Object load​(java.lang.String entityName,
                                     java.io.Serializable id,
                                     LockMode lockMode)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.

        Convenient form of Session.load(String, Serializable, LockOptions)

        Specified by:
        load in interface Session
        Parameters:
        entityName - a persistent class
        id - a valid identifier of an existing persistent instance of the class
        lockMode - the lock level
        Returns:
        the persistent instance or proxy
        See Also:
        Session.load(String, Serializable, LockOptions)
      • load

        public java.lang.Object load​(java.lang.String entityName,
                                     java.io.Serializable id,
                                     LockOptions lockOptions)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
        Specified by:
        load in interface Session
        Parameters:
        entityName - a persistent class
        id - a valid identifier of an existing persistent instance of the class
        lockOptions - contains the lock level
        Returns:
        the persistent instance or proxy
      • load

        public <T> T load​(java.lang.Class<T> theClass,
                          java.io.Serializable id)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.

        You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.
        Specified by:
        load in interface Session
        Parameters:
        theClass - a persistent class
        id - a valid identifier of an existing persistent instance of the class
        Returns:
        the persistent instance or proxy
      • load

        public java.lang.Object load​(java.lang.String entityName,
                                     java.io.Serializable id)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.

        You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.
        Specified by:
        load in interface Session
        Parameters:
        entityName - a persistent class
        id - a valid identifier of an existing persistent instance of the class
        Returns:
        the persistent instance or proxy
      • load

        public void load​(java.lang.Object object,
                         java.io.Serializable id)
        Description copied from interface: Session
        Read the persistent state associated with the given identifier into the given transient instance.
        Specified by:
        load in interface Session
        Parameters:
        object - an "empty" instance of the persistent class
        id - a valid identifier of an existing persistent instance of the class
      • replicate

        public void replicate​(java.lang.Object object,
                              ReplicationMode replicationMode)
        Description copied from interface: Session
        Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped with cascade="replicate"
        Specified by:
        replicate in interface Session
        Parameters:
        object - a detached instance of a persistent class
        replicationMode - The replication mode to use
      • replicate

        public void replicate​(java.lang.String entityName,
                              java.lang.Object object,
                              ReplicationMode replicationMode)
        Description copied from interface: Session
        Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped with cascade="replicate"
        Specified by:
        replicate in interface Session
        Parameters:
        entityName - The entity name
        object - a detached instance of a persistent class
        replicationMode - The replication mode to use
      • save

        public java.io.Serializable save​(java.lang.Object object)
        Description copied from interface: Session
        Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) This operation cascades to associated instances if the association is mapped with cascade="save-update"
        Specified by:
        save in interface Session
        Parameters:
        object - a transient instance of a persistent class
        Returns:
        the generated identifier
      • save

        public java.io.Serializable save​(java.lang.String entityName,
                                         java.lang.Object object)
        Description copied from interface: Session
        Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) This operation cascades to associated instances if the association is mapped with cascade="save-update"
        Specified by:
        save in interface Session
        Parameters:
        entityName - The entity name
        object - a transient instance of a persistent class
        Returns:
        the generated identifier
      • update

        public void update​(java.lang.Object object)
        Description copied from interface: Session
        Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped with cascade="save-update"
        Specified by:
        update in interface Session
        Parameters:
        object - a detached instance containing updated state
      • update

        public void update​(java.lang.String entityName,
                           java.lang.Object object)
        Description copied from interface: Session
        Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped with cascade="save-update"
        Specified by:
        update in interface Session
        Parameters:
        entityName - The entity name
        object - a detached instance containing updated state
      • merge

        public java.lang.Object merge​(java.lang.Object object)
        Description copied from interface: Session
        Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge"

        The semantics of this method are defined by JSR-220.

        Specified by:
        merge in interface EntityManager
        Specified by:
        merge in interface Session
        Parameters:
        object - a detached instance with state to be copied
        Returns:
        an updated persistent instance
      • merge

        public java.lang.Object merge​(java.lang.String entityName,
                                      java.lang.Object object)
        Description copied from interface: Session
        Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge"

        The semantics of this method are defined by JSR-220.

        Specified by:
        merge in interface Session
        Parameters:
        entityName - The entity name
        object - a detached instance with state to be copied
        Returns:
        an updated persistent instance
      • persist

        public void persist​(java.lang.Object object)
        Description copied from interface: Session
        Make a transient instance persistent. This operation cascades to associated instances if the association is mapped with cascade="persist"

        The semantics of this method are defined by JSR-220.

        Specified by:
        persist in interface EntityManager
        Specified by:
        persist in interface Session
        Parameters:
        object - a transient instance to be made persistent
      • persist

        public void persist​(java.lang.String entityName,
                            java.lang.Object object)
        Description copied from interface: Session
        Make a transient instance persistent. This operation cascades to associated instances if the association is mapped with cascade="persist"

        The semantics of this method are defined by JSR-220.

        Specified by:
        persist in interface Session
        Parameters:
        entityName - The entity name
        object - a transient instance to be made persistent
      • delete

        public void delete​(java.lang.Object object)
        Description copied from interface: Session
        Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped with cascade="delete"
        Specified by:
        delete in interface Session
        Parameters:
        object - the instance to be removed
      • delete

        public void delete​(java.lang.String entityName,
                           java.lang.Object object)
        Description copied from interface: Session
        Remove a persistent instance from the datastore. The object argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped with cascade="delete"
        Specified by:
        delete in interface Session
        Parameters:
        entityName - The entity name for the instance to be removed.
        object - the instance to be removed
      • buildLockRequest

        public Session.LockRequest buildLockRequest​(LockOptions lockOptions)
        Description copied from interface: Session
        Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope. timeout and scope is ignored for optimistic locking. After building the LockRequest, call LockRequest.lock to perform the requested locking.

        Example usage: session.buildLockRequest().setLockMode(LockMode.PESSIMISTIC_WRITE).setTimeOut(60000).lock(entity);

        Specified by:
        buildLockRequest in interface Session
        Parameters:
        lockOptions - contains the lock level
        Returns:
        a lockRequest that can be used to lock the passed object.
      • refresh

        public void refresh​(java.lang.Object object)
        Description copied from interface: Session
        Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example
        • where a database trigger alters the object state upon insert or update
        • after executing direct SQL (eg. a mass update) in the same session
        • after inserting a Blob or Clob
        Specified by:
        refresh in interface EntityManager
        Specified by:
        refresh in interface Session
        Parameters:
        object - a persistent or detached instance
      • refresh

        public void refresh​(java.lang.String entityName,
                            java.lang.Object object)
        Description copied from interface: Session
        Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example
        • where a database trigger alters the object state upon insert or update
        • after executing direct SQL (eg. a mass update) in the same session
        • after inserting a Blob or Clob
        Specified by:
        refresh in interface Session
        Parameters:
        entityName - a persistent class
        object - a persistent or detached instance
      • refresh

        public void refresh​(java.lang.Object object,
                            LockMode lockMode)
        Description copied from interface: Session
        Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.

        Convenient form of Session.refresh(Object, LockOptions)

        Specified by:
        refresh in interface Session
        Parameters:
        object - a persistent or detached instance
        lockMode - the lock mode to use
        See Also:
        Session.refresh(Object, LockOptions)
      • refresh

        public void refresh​(java.lang.Object object,
                            LockOptions lockOptions)
        Description copied from interface: Session
        Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.
        Specified by:
        refresh in interface Session
        Parameters:
        object - a persistent or detached instance
        lockOptions - contains the lock mode to use
      • refresh

        public void refresh​(java.lang.String entityName,
                            java.lang.Object object,
                            LockOptions lockOptions)
        Description copied from interface: Session
        Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.
        Specified by:
        refresh in interface Session
        Parameters:
        entityName - a persistent class
        object - a persistent or detached instance
        lockOptions - contains the lock mode to use
      • getCurrentLockMode

        public LockMode getCurrentLockMode​(java.lang.Object object)
        Description copied from interface: Session
        Determine the current lock mode of the given object.
        Specified by:
        getCurrentLockMode in interface Session
        Parameters:
        object - a persistent instance
        Returns:
        the current lock mode
      • createFilter

        @Deprecated
        public Query createFilter​(java.lang.Object collection,
                                  java.lang.String queryString)
        Deprecated.
        Description copied from interface: Session
        Create a Query instance for the given collection and filter string. Contains an implicit FROM element named this which refers to the defined table for the collection elements, as well as an implicit WHERE restriction for this particular collection instance's key value.
        Specified by:
        createFilter in interface Session
        Parameters:
        collection - a persistent collection
        queryString - a Hibernate query fragment.
        Returns:
        The query instance for manipulation and execution
      • clear

        public void clear()
        Description copied from interface: Session
        Completely clear the session. Evict all loaded instances and cancel all pending saves, updates and deletions. Do not close open iterators or instances of ScrollableResults.
        Specified by:
        clear in interface EntityManager
        Specified by:
        clear in interface Session
      • get

        public <T> T get​(java.lang.Class<T> entityType,
                         java.io.Serializable id)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.)
        Specified by:
        get in interface Session
        Parameters:
        entityType - The entity type
        id - an identifier
        Returns:
        a persistent instance or null
      • get

        public <T> T get​(java.lang.Class<T> entityType,
                         java.io.Serializable id,
                         LockMode lockMode)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists.

        Convenient form of Session.get(Class, Serializable, LockOptions)

        Specified by:
        get in interface Session
        Parameters:
        entityType - The entity type
        id - an identifier
        lockMode - the lock mode
        Returns:
        a persistent instance or null
        See Also:
        Session.get(Class, Serializable, LockOptions)
      • get

        public <T> T get​(java.lang.Class<T> entityType,
                         java.io.Serializable id,
                         LockOptions lockOptions)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists.
        Specified by:
        get in interface Session
        Parameters:
        entityType - The entity type
        id - an identifier
        lockOptions - the lock mode
        Returns:
        a persistent instance or null
      • get

        public java.lang.Object get​(java.lang.String entityName,
                                    java.io.Serializable id)
        Description copied from interface: Session
        Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.)
        Specified by:
        get in interface Session
        Parameters:
        entityName - the entity name
        id - an identifier
        Returns:
        a persistent instance or null
      • get

        public java.lang.Object get​(java.lang.String entityName,
                                    java.io.Serializable id,
                                    LockMode lockMode)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists.

        Convenient form of Session.get(String, Serializable, LockOptions)

        Specified by:
        get in interface Session
        Parameters:
        entityName - the entity name
        id - an identifier
        lockMode - the lock mode
        Returns:
        a persistent instance or null
        See Also:
        Session.get(String, Serializable, LockOptions)
      • get

        public java.lang.Object get​(java.lang.String entityName,
                                    java.io.Serializable id,
                                    LockOptions lockOptions)
        Description copied from interface: Session
        Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists.
        Specified by:
        get in interface Session
        Parameters:
        entityName - the entity name
        id - an identifier
        lockOptions - contains the lock mode
        Returns:
        a persistent instance or null
      • getEntityName

        public java.lang.String getEntityName​(java.lang.Object object)
        Description copied from interface: Session
        Return the entity name for a persistent entity.
        Specified by:
        getEntityName in interface Session
        Parameters:
        object - a persistent entity
        Returns:
        the entity name
      • getReference

        public <T> T getReference​(T object)
        Description copied from interface: Session
        Return a reference to the persistent instance with the same identity as the given instance, which might be detached, making the assumption that the instance is still persistent in the database. This method never results in access to the underlying data store, and thus might return a proxy that is initialized on-demand, when a non-identifier method is accessed.
        Specified by:
        getReference in interface Session
        Parameters:
        object - a detached persistent instance
        Returns:
        the persistent instance or proxy
      • byId

        public IdentifierLoadAccess byId​(java.lang.String entityName)
        Description copied from interface: Session
        Create an IdentifierLoadAccess instance to retrieve the specified entity type by primary key.
        Specified by:
        byId in interface Session
        Parameters:
        entityName - The entity name of the entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by primary key
      • byMultipleIds

        public <T> MultiIdentifierLoadAccess<T> byMultipleIds​(java.lang.Class<T> entityClass)
        Description copied from interface: Session
        Create a MultiIdentifierLoadAccess instance to retrieve multiple entities at once as specified by primary key values.
        Specified by:
        byMultipleIds in interface Session
        Parameters:
        entityClass - The entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by primary key values
      • byMultipleIds

        public MultiIdentifierLoadAccess byMultipleIds​(java.lang.String entityName)
        Description copied from interface: Session
        Create a MultiIdentifierLoadAccess instance to retrieve multiple entities at once as specified by primary key values.
        Specified by:
        byMultipleIds in interface Session
        Parameters:
        entityName - The entity name of the entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by primary key values
      • byId

        public <T> IdentifierLoadAccess<T> byId​(java.lang.Class<T> entityClass)
        Description copied from interface: Session
        Create an IdentifierLoadAccess instance to retrieve the specified entity by primary key.
        Specified by:
        byId in interface Session
        Parameters:
        entityClass - The entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by primary key
      • byNaturalId

        public NaturalIdLoadAccess byNaturalId​(java.lang.String entityName)
        Description copied from interface: Session
        Create a NaturalIdLoadAccess instance to retrieve the specified entity by its natural id.
        Specified by:
        byNaturalId in interface Session
        Parameters:
        entityName - The entity name of the entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by natural id
      • byNaturalId

        public <T> NaturalIdLoadAccess<T> byNaturalId​(java.lang.Class<T> entityClass)
        Description copied from interface: Session
        Create a NaturalIdLoadAccess instance to retrieve the specified entity by its natural id.
        Specified by:
        byNaturalId in interface Session
        Parameters:
        entityClass - The entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by natural id
      • bySimpleNaturalId

        public SimpleNaturalIdLoadAccess bySimpleNaturalId​(java.lang.String entityName)
        Description copied from interface: Session
        Create a SimpleNaturalIdLoadAccess instance to retrieve the specified entity by its natural id.
        Specified by:
        bySimpleNaturalId in interface Session
        Parameters:
        entityName - The entity name of the entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by natural id
      • bySimpleNaturalId

        public <T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId​(java.lang.Class<T> entityClass)
        Description copied from interface: Session
        Create a SimpleNaturalIdLoadAccess instance to retrieve the specified entity by its simple (single attribute) natural id.
        Specified by:
        bySimpleNaturalId in interface Session
        Parameters:
        entityClass - The entity type to be retrieved
        Returns:
        load delegate for loading the specified entity type by natural id
      • enableFilter

        public Filter enableFilter​(java.lang.String filterName)
        Description copied from interface: Session
        Enable the named filter for this current session.
        Specified by:
        enableFilter in interface Session
        Parameters:
        filterName - The name of the filter to be enabled.
        Returns:
        The Filter instance representing the enabled filter.
      • getEnabledFilter

        public Filter getEnabledFilter​(java.lang.String filterName)
        Description copied from interface: Session
        Retrieve a currently enabled filter by name.
        Specified by:
        getEnabledFilter in interface Session
        Parameters:
        filterName - The name of the filter to be retrieved.
        Returns:
        The Filter instance representing the enabled filter.
      • disableFilter

        public void disableFilter​(java.lang.String filterName)
        Description copied from interface: Session
        Disable the named filter for the current session.
        Specified by:
        disableFilter in interface Session
        Parameters:
        filterName - The name of the filter to be disabled.
      • getStatistics

        public SessionStatistics getStatistics()
        Description copied from interface: Session
        Get the statistics for this session.
        Specified by:
        getStatistics in interface Session
        Returns:
        The session statistics being collected for this session
      • isReadOnly

        public boolean isReadOnly​(java.lang.Object entityOrProxy)
        Description copied from interface: Session
        Is the specified entity or proxy read-only? To get the default read-only/modifiable setting used for entities and proxies that are loaded into the session:
        Specified by:
        isReadOnly in interface Session
        Parameters:
        entityOrProxy - an entity or HibernateProxy
        Returns:
        true if the entity or proxy is read-only, false if the entity or proxy is modifiable.
        See Also:
        Session.isDefaultReadOnly()
      • setReadOnly

        public void setReadOnly​(java.lang.Object entityOrProxy,
                                boolean readOnly)
        Description copied from interface: Session
        Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode. In read-only mode, no snapshot is maintained, the instance is never dirty checked, and changes are not persisted. If the entity or proxy already has the specified read-only/modifiable setting, then this method does nothing. To set the default read-only/modifiable setting used for entities and proxies that are loaded into the session:
        Specified by:
        setReadOnly in interface Session
        Parameters:
        entityOrProxy - an entity or HibernateProxy
        readOnly - true if the entity or proxy should be made read-only; false if the entity or proxy should be made modifiable
        See Also:
        To override this session's read-only/modifiable setting for entities and proxies loaded by a Query:, Query.setReadOnly(boolean)
      • disconnect

        public java.sql.Connection disconnect()
        Description copied from interface: Session
        Disconnect the session from its underlying JDBC connection. This is intended for use in cases where the application has supplied the JDBC connection to the session and which require long-sessions (aka, conversations).

        It is considered an error to call this method on a session which was not opened by supplying the JDBC connection and an exception will be thrown.

        For non-user-supplied scenarios, normal transaction management already handles disconnection and reconnection automatically.

        Specified by:
        disconnect in interface Session
        Returns:
        the application-supplied connection or null
        See Also:
        Session.reconnect(Connection)
      • reconnect

        public void reconnect​(java.sql.Connection connection)
        Description copied from interface: Session
        Reconnect to the given JDBC connection.
        Specified by:
        reconnect in interface Session
        Parameters:
        connection - a JDBC connection
        See Also:
        Session.disconnect()
      • getLobHelper

        public LobHelper getLobHelper()
        Description copied from interface: Session
        Retrieve this session's helper/delegate for creating LOB instances.
        Specified by:
        getLobHelper in interface Session
        Returns:
        This session's LOB helper
      • addEventListeners

        public void addEventListeners​(SessionEventListener... listeners)
        Description copied from interface: Session
        Add one or more listeners to the Session
        Specified by:
        addEventListeners in interface Session
        Parameters:
        listeners - The listener(s) to add
      • createSQLQuery

        public NativeQuery createSQLQuery​(java.lang.String queryString)
        Description copied from interface: Session
        Create a NativeQuery instance for the given SQL query string.
        Specified by:
        createSQLQuery in interface QueryProducer
        Specified by:
        createSQLQuery in interface Session
        Parameters:
        queryString - The SQL query
        Returns:
        The query instance for manipulation and execution
      • getTenantIdentifier

        public java.lang.String getTenantIdentifier()
        Description copied from interface: SharedSessionContract
        Obtain the tenant identifier associated with this session.
        Specified by:
        getTenantIdentifier in interface SharedSessionContract
        Returns:
        The tenant identifier associated with this session, or null
      • getNamedQuery

        public 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
        Specified by:
        getNamedQuery in interface SharedSessionContract
        Parameters:
        queryName - the name of a pre-defined, named query
        Returns:
        The Query instance for manipulation and execution
      • createStoredProcedureCall

        public ProcedureCall createStoredProcedureCall​(java.lang.String procedureName,
                                                       java.lang.Class... resultClasses)
        Description copied from interface: SharedSessionContract
        Creates a call to a stored procedure with specific result set entity mappings. Each class named is considered a "root return".
        Specified by:
        createStoredProcedureCall in interface SharedSessionContract
        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

        public ProcedureCall createStoredProcedureCall​(java.lang.String procedureName,
                                                       java.lang.String... resultSetMappings)
        Description copied from interface: SharedSessionContract
        Creates a call to a stored procedure with specific result set entity mappings.
        Specified by:
        createStoredProcedureCall in interface SharedSessionContract
        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
        public Criteria createCriteria​(java.lang.Class persistentClass)
        Deprecated.
        Description copied from interface: SharedSessionContract
        Create Criteria instance for the given class (entity or subclasses/implementors).
        Specified by:
        createCriteria in interface SharedSessionContract
        Parameters:
        persistentClass - The class, which is an entity, or has entity subclasses/implementors
        Returns:
        The criteria instance for manipulation and execution
      • createCriteria

        @Deprecated
        public Criteria createCriteria​(java.lang.Class persistentClass,
                                       java.lang.String alias)
        Deprecated.
        Description copied from interface: SharedSessionContract
        Create Criteria instance for the given class (entity or subclasses/implementors), using a specific alias.
        Specified by:
        createCriteria in interface SharedSessionContract
        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
        public Criteria createCriteria​(java.lang.String entityName)
        Deprecated.
        Description copied from interface: SharedSessionContract
        Create Criteria instance for the given entity name.
        Specified by:
        createCriteria in interface SharedSessionContract
        Parameters:
        entityName - The entity name
        Returns:
        The criteria instance for manipulation and execution
      • createCriteria

        @Deprecated
        public Criteria createCriteria​(java.lang.String entityName,
                                       java.lang.String alias)
        Deprecated.
        Description copied from interface: SharedSessionContract
        Create Criteria instance for the given entity name, using a specific alias.
        Specified by:
        createCriteria in interface SharedSessionContract
        Parameters:
        entityName - The entity name
        alias - The alias to use
        Returns:
        The criteria instance for manipulation and execution
      • getNamedSQLQuery

        @Deprecated
        public Query getNamedSQLQuery​(java.lang.String name)
        Deprecated.
        Description copied from interface: QueryProducer
        Get a NativeQuery instance for a named native SQL query
        Specified by:
        getNamedSQLQuery in interface QueryProducer
        Parameters:
        name - The name of the pre-defined query
        Returns:
        The NativeQuery instance for manipulation and execution
      • getNamedNativeQuery

        public NativeQuery getNamedNativeQuery​(java.lang.String name)
        Description copied from interface: QueryProducer
        Get a NativeQuery instance for a named native SQL query
        Specified by:
        getNamedNativeQuery in interface QueryProducer
        Parameters:
        name - The name of the pre-defined query
        Returns:
        The NativeQuery instance for manipulation and execution
      • remove

        public void remove​(java.lang.Object entity)
        Specified by:
        remove in interface EntityManager
      • find

        public <T> T find​(java.lang.Class<T> entityClass,
                          java.lang.Object primaryKey)
        Specified by:
        find in interface EntityManager
      • find

        public <T> T find​(java.lang.Class<T> entityClass,
                          java.lang.Object primaryKey,
                          java.util.Map<java.lang.String,​java.lang.Object> properties)
        Specified by:
        find in interface EntityManager
      • find

        public <T> T find​(java.lang.Class<T> entityClass,
                          java.lang.Object primaryKey,
                          LockModeType lockMode)
        Specified by:
        find in interface EntityManager
      • find

        public <T> T find​(java.lang.Class<T> entityClass,
                          java.lang.Object primaryKey,
                          LockModeType lockMode,
                          java.util.Map<java.lang.String,​java.lang.Object> properties)
        Specified by:
        find in interface EntityManager
      • getReference

        public <T> T getReference​(java.lang.Class<T> entityClass,
                                  java.lang.Object primaryKey)
        Specified by:
        getReference in interface EntityManager
      • lock

        public void lock​(java.lang.Object entity,
                         LockModeType lockMode,
                         java.util.Map<java.lang.String,​java.lang.Object> properties)
        Specified by:
        lock in interface EntityManager
      • refresh

        public void refresh​(java.lang.Object entity,
                            java.util.Map<java.lang.String,​java.lang.Object> properties)
        Specified by:
        refresh in interface EntityManager
      • refresh

        public void refresh​(java.lang.Object entity,
                            LockModeType lockMode,
                            java.util.Map<java.lang.String,​java.lang.Object> properties)
        Specified by:
        refresh in interface EntityManager
      • detach

        public void detach​(java.lang.Object entity)
        Specified by:
        detach in interface EntityManager
      • contains

        public boolean contains​(java.lang.Object entity)
        Specified by:
        contains in interface EntityManager
      • setProperty

        public void setProperty​(java.lang.String propertyName,
                                java.lang.Object value)
        Specified by:
        setProperty in interface EntityManager
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getProperties()
        Specified by:
        getProperties in interface EntityManager
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> cls)
        Specified by:
        unwrap in interface EntityManager