Class SingleEntityProjectionQuery<E extends BaseEntity,R>
java.lang.Object
com.github.collinalpert.java2db.queries.SingleEntityProjectionQuery<E,R>
- All Implemented Interfaces:
SingleQueryable<R>
- Direct Known Subclasses:
AsyncSingleEntityProjectionQuery,EntityProjectionQuery
public class SingleEntityProjectionQuery<E extends BaseEntity,R> extends java.lang.Object implements SingleQueryable<R>
- Author:
- Collin Alpert
-
Field Summary
Fields Modifier and Type Field Description protected SingleEntityQuery<E>originalQueryprotected java.lang.Class<R>returnType -
Constructor Summary
Constructors Constructor Description SingleEntityProjectionQuery(com.github.collinalpert.lambda2sql.functions.SqlFunction<E,R> projection, SingleEntityQuery<E> originalQuery) -
Method Summary
-
Field Details
-
Constructor Details
-
SingleEntityProjectionQuery
public SingleEntityProjectionQuery(com.github.collinalpert.lambda2sql.functions.SqlFunction<E,R> projection, SingleEntityQuery<E> originalQuery)
-
-
Method Details
-
first
Description copied from interface:SingleQueryableGets the first value from the database result. This method should be used when only one result is expected.- Specified by:
firstin interfaceSingleQueryable<E extends BaseEntity>- Returns:
- The first row as an entity wrapped in an
Optionalif there is at least one row. OtherwiseOptional.empty()is returned. If the value from the database isnull, an emptyOptionalis also returned.
-
getQuery
public java.lang.String getQuery()Description copied from interface:SingleQueryableResponsible for building and returning the individual DQL statement.- Specified by:
getQueryin interfaceSingleQueryable<E extends BaseEntity>- Returns:
- The DQL statement which fetches data from the database.
-