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.

Adding entries. The following general steps add entries to an existing typemap:1. Obtain the type map you want to maintain. This can be a newly createdtype map, or an existing map. For example:java.util.Dictionary myMap = conn.getTypeMap();where getMapType() method on the Connection object conn returns themyMap Dictionary object2. Use the Dictionary object’s put() method to add entries to the map. Theput() method takes two arguments.a. A database class name string:myMap.put(dbClassName, classObject);where:- dbClassName is a string that represents the name of the class inthe database- classObject is the Java class object to which maps to thedatabase classb. The name of the Java class object to which you want to map it. Getthe java class object with the class.forName() method. You can rewritethe put() method as:myMap.put(dbClassName, class.forName(className));For example, if you have a resort class defined in the database schema,then map it to a Java class defined as jresort with this statement:myMap.put("resort", class.forName("jresort"));The map now has an entry that maps the resort class in the database tothe jresort Java class.3. When you finish adding entries to the map, use the Connection object’ssetTypeMap() method to overwrite the connection’s existing type map. Forexample:conn.setTypeMap(myMap);where setTypeMap() overwrites the connection’s original map withmyMap<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 49Chapter: 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!