code: private void appendClazzColumnForSelect(StringBuffer buf)
      {
          ClassDescriptor cld = getSearchClassDescriptor();
          ClassDescriptor[] clds = getMultiJoinedClassDescriptors(cld);
  
          if (clds.length == 0)
          {
              return;
          }
          
          buf.append(",CASE");
  
          for (int i = clds.length; i > 0; i--)
          {
              buf.append(" WHEN ");
  
              ClassDescriptor subCld = clds[i - 1];
              FieldDescriptor[] fieldDescriptors = subCld.getPkFields();
  
              TableAlias alias = getTableAliasForClassDescriptor(subCld);
              for (int j = 0; j < fieldDescriptors.length; j++)
              {
                  FieldDescriptor field = fieldDescriptors[j];
                  if (j > 0)
                  {
                      buf.append(" AND ");
                  }
                  appendColumn(alias, field, buf);
                  buf.append(" IS NOT NULL");
              }
              buf.append(" THEN '").append(subCld.getClassNameOfObject()).append("'");
          }
          buf.append(" ELSE '").append(cld.getClassNameOfObject()).append("'");
          buf.append(" END AS " + SqlHelper.OJB_CLASS_COLUMN);
      }
docs: Create the OJB_CLAZZ pseudo column based on CASE WHEN.
  This column defines the Class to be instantiated.
  @param buf