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.

}Statement stmt = conn.createStatement();ResultSet rset = stmt.executeQuery ("SELECT identity FROM resort");// get the first resort referenceordbjava.jdbc.ordbObject resortRef = null;rset.next();resortRef = (ordbjava.jdbc.ordbObject)rset.getRef(1);rset.close();// get the resort as custom mapped classjresort resort = (jresort)resortRef.getObject();// get the beach using custom mappingjseashore seashore = (jseashore)resort.beach.getObject();System.out.println(" beach description of first resort before update: "+seashore.description);// delete the seashore instanceseashore.deleteInstance();// create a new seashore instance template(not yet in the database)seashore = new jseashore(conn);// update the attributes with valuesseashore.description = "new seashore";seashore.has_lifeguard = "yes";seashore.has_beach_chairs = "no";// add the instance to the databaseseashore.writeSQL(seashore);// update resort to reference new beachresort.beach = seashore;resort.writeSQL(resort);<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 56Chapter: 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!