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.

create a new collection of seashore referencesordbCollection seashores = new ordbCollection(conn);ResultSet rs = stmt.executeQuery("select beach from resort");while (rs.next())seashores.insertValue(rs.getRef(1),Types.REF,1);Object [] beachRefs = (Object [])seashores.getArray();// custom mapping was not performed automatically// The following loop uses three different ways to// obtain the description from the seashore instanceObject [] beachAttrs = null;for (int i=0; i < beachRefs.length; i++) {// One way is to use the java.sql.Struct interface// (description is 1st attribute in seashore schema definition)beachAttrs = ((Struct)beachRefs[i]).getAttributes();System.out.println("beach description(Struct): " + beachAttrs[0] );// Another way is to explicitly invoke custom mapping// This of course assumes that we have a mapping definedjseashore beachx =(jseashore)((ordbObject)beachRefs[i]).getObject();System.out.println("beach description(map): " + beachx.description);// Another way is to use the getAttributeValue method of ordbObjectordbObject beacho = (ordbObject)beachRefs[i];System.out.println("beach description(getAttr): " +beacho.getAttributeValue("description") );}<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 74Chapter: 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!