Polypheny JDBC Driver - Result

On this page

The Result object in the Polypheny JDBC Multimodel Extension encapsulates the outcome of queries executed using the PolyStatement object. It serves as a wrapper for different types of results such as RelationalResult, DocumentResult, GraphResult, and ScalarResult.


public ResultType getResultType()

Returns the type of the encapsulated result.

Return Type:

  • Returns one of the following ResultType constants: Result.RELATIONAL, Result.DOCUMENT, Result.GRAPH, Result.SCALAR.


ResultType type = result.getResultType();


public <T> T unwrap(Class<T> aClass) throws ProtoInterfaceServiceException

Unwraps the encapsulated result to its specific type, based on the type parameter passed to the unwrap method.


Parameter Type Description
aClass Class<T> The class to which the result should be unwrapped.

Return Type:

Returns an instance of the specified class.


Throws a ProtoInterfaceServiceException if the result cannot be unwrapped to the specified class type.

Result Types:

Result Type Unwrap To Description
Result.RELATIONAL RelationalResult.class The result contains relational data and can be unwrapped to a RelationalResult object.
Result.DOCUMENT DocumentResult.class The result contains document-based data and can be unwrapped to a DocumentResult object.
Result.GRAPH GraphResult.class The result contains graph-based data and can be unwrapped to a GraphResult object.
Result.SCALAR ScalarResult.class The result contains scalar values and can be unwrapped to a ScalarResult object.


try {
    switch (result.getResultType()) {
        case Result.RELATIONAL:
            RelationalResult relationalResult = result.unwrap(RelationalResult.class);
            // Process the relational result...

        case Result.DOCUMENT:
            DocumentResult documentResult = result.unwrap(DocumentResult.class);
            // Process the document result...

        case Result.GRAPH:
            GraphResult graphResult = result.unwrap(GraphResult.class);
            // Process the graph result...

        case Result.SCALAR:
            ScalarResult scalarResult = result.unwrap(ScalarResult.class);
            // Process the scalar result...

            // Handle other types...
} catch (ProtoInterfaceServiceException e) {
© Polypheny GmbH. All Rights Reserved.