Apart from the standard data types (such as Varchar, Integer etc.) the WSO2 Data Services Server also supports querying of custom objects, which are usually called User Defined Types (UDT). The Data Services Server enables users to query UDTs with ordinary SQL queries as well as OUT parameters of stored procedures.
Query UDTs with Ordinary SQL Queries
In this option, you are only required to define an output mapping corresponding to the UDT to be queried. An important point is that the attributes of a UDT is queried depending on the order they are specified in the UDT. For example, if the UDT carries the structure "SampleUDT ", then the attribute index "0" maps to the attribute "Id". Similarly, attribute "Name" can be retrieved via the index "1". The following image depicts how it is done in the Data Services Wizard:
Query UDTs via OUT Parameters of a Stored Procedure
It is possible to retrieve the values of UDTs via the OUT parameters defined in stored procedures. The user should define an input mapping as an OUT parameter as well as an output mappings, in order to actually retrieve the values of the UDT attributes.
Shown below is an example of how we can define the Input mapping in order to register an OUT parameter to be able to retrieve the value of a sample UDT called "PERSON_T".