Interface TopiaQueryBuilderRunQueryWithUniqueResultStep<E extends TopiaEntity>

All Known Subinterfaces:
TopiaQueryBuilderAddCriteriaOrRunQueryStep<E>, TopiaQueryBuilderRunQueryStep<E>
All Known Implementing Classes:
AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep, AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep

public interface TopiaQueryBuilderRunQueryWithUniqueResultStep<E extends TopiaEntity>
A subset of TopiaQueryBuilderRunQueryStep for certain API methods that should not allow findAll.
Since:
3.0
Author:
bleny
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Get the first element of a single-element result set.
    Get the first element of a single-element result set or null if query result is empty.
    com.google.common.base.Optional<E>
    Get the first element of a single-element result set.
  • Method Details

    • exists

      boolean exists()
      Returns:
      true if the query returns at least one element
    • findUnique

      Get the first element of a single-element result set.
      Returns:
      the first value from the set of result. Returned value can't be null
      Throws:
      TopiaNonUniqueResultException - if the query returns more than one element.
      TopiaNoResultException - if the query does not return any result.
    • findUniqueOrNull

      E findUniqueOrNull() throws TopiaNonUniqueResultException
      Get the first element of a single-element result set or null if query result is empty. This method duplicates tryFindUnique() but allows you to prevent using Guava in you project.
      Returns:
      the first value from the set of result, or null of result set for given query is empty.
      Throws:
      TopiaNonUniqueResultException - if the query returns more than one element.
    • tryFindUnique

      com.google.common.base.Optional<E> tryFindUnique() throws TopiaNonUniqueResultException
      Get the first element of a single-element result set. If the call must return a result, prefer findUnique()
      Returns:
      the first value from the set of result. It's an optional because the query may return no result.
      Throws:
      TopiaNonUniqueResultException - if the query returns more than one element.