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.

get the first resort referenceordbjava.jdbc.ordbObject resort = null;rset.next();// cast to ordbObject because we want to use the <strong>Cincom</strong> ORDBjdbc extensionsresort = (ordbjava.jdbc.ordbObject)rset.getRef(1);rset.close();// get the beach reference from the resort (instance ofseashore)ordbjava.jdbc.ordbObject beach =(ordbjava.jdbc.ordbObject)resort.getAttributeValue("beach");// display the descriptionpstmt.setRef(1, resort);rset = pstmt.executeQuery();rset.next();System.out.println(" beach description of first resort beforeupdate: " +rset.getString(1));rset.close();//delete the seashore instancebeach.deleteInstance();// create a new seashore instance (not yet in the database)beach = new ordbjava.jdbc.ordbObject(conn, "seashore");// update the attributes with valuesbeach.setAttributeValue("description", new String("newseashore"));beach.setAttributeValue("has_lifeguard", new String("yes"));beach.setAttributeValue("has_beach_chairs", new String("no"));// add the instance to the databasebeach.updateInstance();// update resort to reference the newly created seashoreinstanceresort.setAttributeValue("beach", beach);resort.updateInstance();<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 34Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Working with <strong>Cincom</strong> ORDB objects and object references

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

Saved successfully!

Ooh no, something went wrong!