- All Known Subinterfaces:
QueryMapper.MapperFrom
,QueryMapper.MapperLimit
,QueryMapper.MapperNameOrder
,QueryMapper.MapperSkip
,QueryMapper.MapperWhere
- Enclosing interface:
QueryMapper
public static interface QueryMapper.MapperQueryBuild
Represents the last step of the query fluent API execution.
-
Method Summary
-
Method Details
-
result
Executes the query and returns the result as aList
.- Type Parameters:
T
- the entity type- Returns:
- the result of the query
- Throws:
UnsupportedOperationException
- If a NoSQL database does not support a specific operation or if the database does not support certain query conditions, an exception will be raised. For example, a wide-column may not support the OR operator, or a document database may not support the BETWEEN operator. The level of NoSQL database support for various conditions may vary depending on the database provider.
-
stream
Executes the query and returns the result as aStream
.- Type Parameters:
T
- the entity type- Returns:
- the result of the query
- Throws:
UnsupportedOperationException
- If a NoSQL database does not support a specific operation or if the database does not support certain query conditions, an exception will be raised. For example, a wide-column may not support the OR operator, or a document database may not support the BETWEEN operator. The level of NoSQL database support for various conditions may vary depending on the database provider.
-
singleResult
Executes the query and returns the result as a single element, wrapped in anOptional
. If the query returns exactly one result, that result is returned in the Optional. If no result is found,Optional.empty()
is returned. If more than one result is found, an exception specific to the Jakarta NoSQL provider may be thrown.Use this method when expecting a single result from a query. It provides a safe way to handle the case where zero or one result is expected, while also allowing for exceptional cases where multiple results are returned.
- Type Parameters:
T
- the type of the entity being queried- Returns:
- an Optional containing the single result of the query, if present, or empty if no result is found
- Throws:
UnsupportedOperationException
- If a NoSQL database does not support a specific operation or if the database does not support certain query conditions, an exception will be raised. For example, a wide-column may not support the OR operator, or a document database may not support the BETWEEN operator. The level of NoSQL database support for various conditions may vary depending on the database provider.
-