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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Turn off AutoPerformCustomMapping (the default is off)ordbjava.jdbc.ordbObject.setAutoPerformCustomMapping(false);Statement stmt = conn.createStatement();// build result set of resort referencesResultSet rset = stmt.executeQuery("SELECT resort.IDENTITY from resort WHERE beach IS NOT NULL");// We are using the <strong>Cincom</strong> ORDB extensions, so we will ask forordbObjectordbjava.jdbc.ordbObject resort = null;while (rset.next ()) {resort = ((ordbjava.jdbc.ordbObject)rset.getRef(1));// ordbObject implements the java.sql.Struct interface, so we// can call the Struct methodsObject [] resortAttrs = resort.getAttributes();// Now the array resortAttrs has the values of the resort// instance attributes. The 1st attribute value is// in resortAttrs[0].// Here is the mapping based on the demodb schema:// resortAttrs Index Attribute Name// ---------------- ---------------------------// 0 off_season// 1 rooms// 2 number_of_restaurants// 3 number_of_pools// 4 allows_children// 5 checkout_time// 6 country// 7 cost// 8 name// 9 photo// 10 cabins// 11 beach// 12 has_daycare<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 53Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Creating custom Java classes for <strong>Cincom</strong> ORDB objects

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

Saved successfully!

Ooh no, something went wrong!