While working on the new Cincom® ObjectStudio® mapping tool that generates code for the object-relational mapping framework GLORP, we built some GUI for handling database converters.

Let’s take a quick look at today’s GLORP database converters. Database converters are used for converting back and forth between database and object representations. They are used by Direct Mappings where one column of a table is mapped with one instance variable of a class.

A Direct Mapping in GLORP is normally coded like this:

(aDescriptor newMapping: DirectMapping)
              from: #catalogID
              to: (table fieldNamed: ‘CATALOG_ID’).

Depending on the information in the table and class model descriptor, GLORP automatically assigns a database converter to the mapping. In this particular case, since catalogID is a string and the field CATALOG_ID is defined as a varchar:, 255 GLORP will assign it the DelegatingDatabaseConverter named stringToString. So if you want different behavior, you can write your own converter and assign it to the Direct Mapping with the converter: setting method.