code: private int bindStatementValue(PreparedStatement stmt, int index, Object attributeOrQuery, Object value, ClassDescriptor cld)
              throws SQLException
      {
          FieldDescriptor fld = null;
          // if value is a subQuery bind it
          if (value instanceof Query)
          {
              Query subQuery = (Query) value;
              return bindStatement(stmt, subQuery, cld.getRepository().getDescriptorFor(subQuery.getSearchClass()), index);
          }
  
          // if attribute is a subQuery bind it
          if (attributeOrQuery instanceof Query)
          {
              Query subQuery = (Query) attributeOrQuery;
              bindStatement(stmt, subQuery, cld.getRepository().getDescriptorFor(subQuery.getSearchClass()), index);
          }
          else
          {
              fld = cld.getFieldDescriptorForPath((String) attributeOrQuery);
          }
  
          if (fld != null)
          {
              // BRJ: use field conversions and platform
              if (value != null)
              {
                  m_platform.setObjectForStatement(stmt, index, fld.getFieldConversion().javaToSql(value), fld.getJdbcType().getType());
              }
              else
              {
                  m_platform.setNullForStatement(stmt, index, fld.getJdbcType().getType());
              }
          }
          else
          {
              if (value != null)
              {
                  stmt.setObject(index, value);
              }
              else
              {
                  stmt.setNull(index, Types.NULL);
              }
          }
  
          return ++index; // increment before return
      }
docs: bind attribute and value
  @param stmt
  @param index
  @param attributeOrQuery
  @param value
  @param cld
  @return
  @throws SQLException