Collections and arrays
The JDBC 3.0 specification describes only one method to exchange collection data between a Java™ client and a relational database: an array.
Because the array interface does not include a constructor, HCL OneDB™ JDBC Driver includes an extension that allows a java.util.Collection object to be used in the PreparedStatement.setObject() and ResultSet.getObject() methods.
If you prefer to use an Array object, use the PreparedStatement.setArray() and ResultSet.getArray() methods. A Collection object is easier to use, but an Array object conforms to JDBC 3.0 standards.
By default, the driver maps LIST columns to java.util.ArrayList objects and SET and MULTISET columns to java.util.HashSet objects during a fetch. You can override these defaults, but the class you use must implement the java.util.Collection interface.
To override this default mapping, you can use other classes in the java.util.Collection interface, such as the TreeSet class. You can also create your own classes that implement the java.util.Collection interface. In either case, you must provide a customized type map using the Connection.setTypeMap() method.
During an INSERT operation, any java.util.Collection object that is an instance of the java.util.Set interface is mapped to the HCL OneDB MULTISET data type. An instance of the java.util.List interface is mapped to the HCL OneDB LIST data type. You can override these defaults by creating a customized type mapping.
The complete versions of all of the examples in the following sections are in the complex-types directory where you installed the driver. For more information, see Sample code files.