Class SingleEntityProjectionQuery<E extends BaseEntity,​R>

    • Constructor Detail

      • SingleEntityProjectionQuery

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

      • first

        public 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 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.