Interface Output
- All Known Subinterfaces:
ResultSetOutput<T>, UpdateCountOutput
public interface Output
Common contract for individual outputs which can be either results
or update counts.
- API Note:
- Although any of the
asResultSetOutput()forms may be called multiple times, care should be taken to ensure that the same expected mapping is used each time.
-
Method Summary
Modifier and TypeMethodDescriptionTreat this output as aResultSetOutput, using the mapping defined when the query was created, if one.<X> ResultSetOutput<X> asResultSetOutput(jakarta.persistence.sql.ResultSetMapping<X> resultSetMapping) Treat this output as aResultSetOutput, with the specified `resultSetMapping.<X> ResultSetOutput<X> asResultSetOutput(Class<X> resultType) Treat this output as aResultSetOutput, with the specifiedresultType.Treat this output as aUpdateCountOutput.booleanDetermine if this output is a result.
-
Method Details
-
isResultSet
boolean isResultSet()Determine if this output is a result. Negative indicates it is an update count instead.- See Also:
-
asResultSetOutput
ResultSetOutput<?> asResultSetOutput()Treat this output as aResultSetOutput, using the mapping defined when the query was created, if one.- Throws:
IllegalOutputTypeException- if the output is aUpdateCountOutput.
-
asResultSetOutput
Treat this output as aResultSetOutput, with the specifiedresultType. If a mapping was specified during query creation, we simply validate that the types match. Otherwise, theresultTypeis used to define a mapping.- Type Parameters:
X- The java type of the mapping.- Throws:
IllegalOutputTypeException- if the output is aUpdateCountOutput.TypeMismatchException- if the givenresultTypedoes not match expectation.
-
asResultSetOutput
<X> ResultSetOutput<X> asResultSetOutput(jakarta.persistence.sql.ResultSetMapping<X> resultSetMapping) Treat this output as aResultSetOutput, with the specified `resultSetMapping. This form will override any mapping specified during query creation.- Type Parameters:
X- The java type of the mapping.- Throws:
IllegalOutputTypeException- if the output is aUpdateCountOutput.
-
asUpdateCountOutput
UpdateCountOutput asUpdateCountOutput()Treat this output as aUpdateCountOutput.- Throws:
IllegalOutputTypeException- if the output is aUpdateCountOutput.
-