Class AbstractHibernateQueryAdapter

java.lang.Object
ch.tocco.nice2.persist.core.spi.entity.query.ql.AbstractOrderableQuery
ch.tocco.nice2.persist.core.impl.hibernate.pojo.AbstractHibernateQueryAdapter
All Implemented Interfaces:
Query
Direct Known Subclasses:
EmptyQuery, HibernateQueryAdapter

public abstract class AbstractHibernateQueryAdapter extends AbstractOrderableQuery
  • Field Details

  • Constructor Details

    • AbstractHibernateQueryAdapter

      protected AbstractHibernateQueryAdapter(EntityManager entityManager)
  • Method Details

    • execute

      public EntityList execute() throws PersistException
      Description copied from interface: Query
      Execute the query in Query.Mode.LAZY mode using the default limit.
      Returns:
      The result of the query. To further process it use the EntityLists class.
      Throws:
      PersistException - If an error occurs
    • execute

      public EntityList execute(Pagination pagination)
      Description copied from interface: Query
      Execute the query using the specified pagination parameters in Query.Mode.LAZY mode.
      Parameters:
      pagination - The offset and limit of the query.
      Returns:
      The result of the query.
    • execute

      public EntityList execute(Query.Mode mode) throws PersistException
      Description copied from interface: Query
      Execute the query in the specified Query.Mode using the default limit.
      Parameters:
      mode - The query mode.
      Returns:
      The result of the query.
      Throws:
      PersistException - If an error occurs
    • execute

      public EntityList execute(int limit) throws PersistException
      Description copied from interface: Query
      Execute the query using the specified limit in Query.Mode.LAZY mode.
      Parameters:
      limit - The maximum number of results, see class header (really).
      Returns:
      The result of the query.
      Throws:
      PersistException - If an error occurred.
    • execute

      public EntityList execute(int limit, Query.Mode mode) throws PersistException
      Description copied from interface: Query
      Execute the query using the specified limit in the specified Query.Mode.
      Parameters:
      limit - The maximum number of results, see class header (really).
      mode - The mode.
      Returns:
      The result of the query.
      Throws:
      PersistException - If an error occurred.
    • uniqueResult

      public Entity uniqueResult() throws PersistException
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or throws.
      Returns:
      The single selected Entity.
      Throws:
      PersistException
      See Also:
    • uniqueResultOrNull

      @Nullable public @Nullable Entity uniqueResultOrNull() throws PersistException
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or null if none, or throws.
      Returns:
      The single selected Entity, or null if none.
      Throws:
      PersistException
      See Also:
    • getOnlyResult

      public Entity getOnlyResult(LockMode lockMode)
    • getOnlyResultOrNull

      @Nullable public @Nullable Entity getOnlyResultOrNull()
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or null if none, or throws.
      Returns:
      The single selected Entity, or null if none.
      See Also:
    • firstResult

      public Entity firstResult() throws PersistException
      Description copied from interface: Query
      Executes and returns the first selected Entity by this query, or throws.
      Returns:
      The first selected Entity.
      Throws:
      PersistException
      See Also:
    • firstResultOrNull

      @Nullable public @Nullable Entity firstResultOrNull() throws PersistException
      Description copied from interface: Query
      Executes and returns the first selected Entity by this query, or null if none.
      Returns:
      The first selected Entity, or null if none.
      Throws:
      PersistException - If an error occurred.
      See Also:
    • getOnlyResult

      public Entity getOnlyResult()
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or throws.
      Returns:
      The single selected Entity.
      See Also:
    • getManager

      public EntityManager getManager()
      Description copied from interface: Query
      Get the entity manager.
      Returns:
      The entity manager.