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.

Using the getAttributes method of the java.sql.StructinterfaceBy default, the getAttributes methods of the java.sql.Struct interface(implemented by ordbObject) will return database object references as typejava.sql.Ref.The static method ordbObject.setAutoPerformCustomMapping directsgetAttributes whether or not custom mapping should perform on databasereferences.The following example uses custom mapping with and without automaticinvocation. This sample code may be found in the%ORDB%\demo\jdbc\samples\customMappingSample1.java file://// This sample program demonstrates the use of custom mapping//package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;import java.awt.*;import ordbjava.jdbc.*;import java.util.HashMap;//import for custom mappingclass customMappingSample {public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (false);try{// add a type map to relate java class jseashore to database class// seashore.conn.getTypeMap().put("seashore",Class.forName("demo.jdbc.samples.jseashore"));} catch(ClassNotFoundException e){System.out.println("***Caught SQLException: " + e.getMessage());}<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 52Chapter: 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!