Documentation: http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#JJDBC28574

SQL> CREATE OR REPLACE TYPE tableOneExample AS OBJECT (
  2        somethingOne                 VARCHAR2 (4)
  3       ,somethingTwo        NUMBER (12)
  4  );
  5  /
 
TYPE created.
 
SQL> CREATE OR REPLACE TYPE outputOneSQLType IS TABLE OF tableOneExample;
  2  /
 
TYPE created.
 
SQL>
SQL> CREATE OR REPLACE PROCEDURE myprocedure (
  2  inputParam                IN       VARCHAR2,
  3  outputOne                 OUT outputOneSQLType)
  4  AS
  5  BEGIN
  6  outputOne  := outputOneSQLType(tableOneExample('a', 1), tableOneExample('b', 2));
  7  END;
  8  /
 
PROCEDURE created.

SQLDATA interface:

import java.sql.*;
 
public class TestArr implements SQLData
 {
  private String sql_type;
 
  public String attrOne;
  public int    attrTwo;
 
  public TestArr() 
  { 
  }
  public TestArr (String sql_type, String attrOne, int attrTwo)
  {
    this.sql_type = sql_type;
    this.attrOne = attrOne;
    this.attrTwo = attrTwo;
   }
 
  // define a get method to return the SQL type of the object
  public String getSQLTypeName() throws SQLException
  { 
    return sql_type; 
  } 
 
  // define the required readSQL() method 
  public void readSQL(SQLInput stream, String typeName)
    throws SQLException
  {
    sql_type = typeName;
 
    attrOne = stream.readString();
    attrTwo = stream.readInt();
  }  
  // define the required writeSQL() method 
  public void writeSQL(SQLOutput stream)
    throws SQLException
  { 
    stream.writeString(attrOne);
    stream.writeInt(attrTwo);
  }
}

Make sure the inputs and ordering of the stream writes/reads are the same as your oracle type, as any inconsistencies will give internal representation errors.

Then in the main class, you’d map this as follows:

CallableStatement stmt = conn.prepareCall("begin myprocedure(?,?); end;");
stmt.setString(1, "foo");
stmt.registerOutParameter(2, java.sql.Types.ARRAY, "OUTPUTONESQLTYPE"); // YOUR ARRAY TYPE (TO MATCH THE API OUTPUT), NOT OBJECT
stmt.execute();
Array arr = stmt.getArray (2);
Map map = conn.getTypeMap();
map.put("TABLEONEEXAMPLE", Class.forName("TestArr")); // YOUR OBJECT TYPE, NOT ARRAY.
Object[] values = (Object[]) arr.getArray();
for (int i=; i < values.length; i++)
{
  TestArr a = (TestArr)values[i];
  System.out.println("somethingOne: " + a.attrOne);
  System.out.println("somethingTwo: " + a.attrTwo);
}