Class SingleEntityProjectionQuery<E extends BaseEntity,​R>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Class<R> returnType  
    • Method Summary

      Modifier and Type Method Description
      java.util.Optional<R> first()
      Gets the first value from the database result.
      java.lang.String getQuery()
      Responsible for building and returning the individual DQL statement.
      • Methods inherited from class java.lang.Object

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

      • returnType

        protected final java.lang.Class<R> returnType
    • Constructor Detail

      • SingleEntityProjectionQuery

        public SingleEntityProjectionQuery​(com.github.collinalpert.lambda2sql.functions.SqlFunction<E,​R> projection,
                                           SingleEntityQuery<E> originalQuery)
    • Method Detail

      • first

        public java.util.Optional<R> first()
        Description copied from interface: SingleQueryable
        Gets the first value from the database result. This method should be used when only one result is expected.
        Specified by:
        first in interface SingleQueryable<E extends BaseEntity>
        Returns:
        The first row as an entity wrapped in an Optional if there is at least one row. Otherwise Optional.empty() is returned. If the value from the database is null, an empty Optional is also returned.
      • getQuery

        public java.lang.String getQuery()
        Description copied from interface: SingleQueryable
        Responsible for building and returning the individual DQL statement.
        Specified by:
        getQuery in interface SingleQueryable<E extends BaseEntity>
        Returns:
        The DQL statement which fetches data from the database.