Class JdbcJsonArrayOutput

  • All Implemented Interfaces:
    ComponentLifecycle, ComponentLifecycleExtension, ResultSetTranslator

    @ComponentProfile(summary="Output all result sets as a JSON Array",
                      tag="json,jdbc")
    public class JdbcJsonArrayOutput
    extends JdbcJsonOutput
    Implementation of ResultSetTranslator that iterates over all resultsets as a json array.

    This differs from JdbcJsonOutput in that it will iterate over all possible result sets returned by the JDBC operation; generally speaking for a select, it will only be 1, but for a Stored procedured it could be multiple; and outputs each result set as an element of a array. So if you have multiple result sets then this would be the output:

       
    [{
        "result": [{
            "firstName": "John",
            "lastName": "Doe"
        }, {
            "firstName": "Anna",
            "lastName": "Smith"
        }, {
            "firstName": "Peter",
            "lastName": "Jones"
        }]
    }, {
        "result": [{
            "firstName": "Sherlock",
            "lastName": "Holmes"
        }, {
            "firstName": "John",
            "lastName": "Watson"
        }, {
            "firstName": "Charles",
            "lastName": "Darwin"
        }]
    }]  
       
       
     

    In the adapter configuration file this class is aliased as jdbc-json-all-resultset-output which is the preferred alternative to the fully qualified classname when building your configuration.