10.07.2015 Views

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Homogeneous collections and Java primitive arraysThe getArray methods of the java.sql.Array interface specify that arrays ofprimitive data types shall be returned as a java array of primitive types.This causes problems if the underlying homogeneous <strong>Cincom</strong> ORDB collectionhas elements that are null. The java primitive cannot represent null.We have provided two methods that allow you to deal with this issue:♦♦getAlwaysReturnObjects() - Allows you to determine if the getArraymethods can return primitive arrays or will always return object arrays.setAlwaysReturnObjects(boolean boolVal) - Allows you to indicate if thegetArray method should always return java Object arrays. (Primitives arereturned as java objects within this array.)The getArray method will throw an exception when attempting to transfer anull into a primitive.Default setting is for getArray to either return a primitive array or object array.Heterogeneous database collections always return array of objects.This example demonstrates the use of these methods and can be found in the%ORDB%\demo\jdbc\samples\collectionSample3.java file://// This sample demonstrates the ordbCollection methods that deal with// homogeneous collections of primitive datatypes.package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;import ordbjava.jdbc.*;import java.util.HashMap;//import for custom mappingclass collectionSample3 {<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 67Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Working with <strong>Cincom</strong> ORDB collections

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!