code: public static Object handleColumnValue(final Object oldValue, final Database database,
           final WktInsertOrUpdateGenerator generator) {
        Object newValue = oldValue;
        if (oldValue instanceof Geometry) {
           final Geometry geometry = (Geometry) oldValue;
           final String wkt = geometry.toText();
           String sridString = null;
           if (geometry.getSRID() > 0) {
              sridString = String.valueOf(geometry.getSRID());
           }
           newValue = generator.convertToFunction(wkt, sridString, database);
        } else if (oldValue instanceof String) {
           final String value = oldValue.toString().trim();
           final Matcher matcher = EWKT_PATTERN.matcher(value);
           if (matcher.matches()) {
              final String sridString = matcher.group(2);
              final String wkt = matcher.group(3);
              final String function = generator.convertToFunction(wkt, sridString,
                    database);
              newValue = function;
           }
        }
        return newValue;
     }
docs: If the old value is a geometry or a Well-Known Text, convert it to the
  appropriate new value. Otherwise, this method returns the old value.
  
  @param oldValue
  the old value.
  @param database
  the database instance.
  @param generator
  the SQL generator.
  @return the new value.