/**
   * Do code generation for this conversion of a value from the Java to the SQL domain.
   *
   * @param acb The ExpressionClassBuilder for the class we're generating
   * @param mb the method the expression will go into
   * @exception StandardException Thrown on error
   */
  public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
      throws StandardException {
    TypeId resultType;
    String resultTypeName;

    /*
     ** Tell the Java node that it's value is being returned to the
     ** SQL domain.  This way, it knows whether the checking for a null
     ** receiver is to be done at the Java level or the SQL level.
     */
    javaNode.returnValueToSQLDomain();

    /* Generate the receiver, if any. */
    boolean hasReceiver = javaNode.generateReceiver(acb, mb);

    /*
     ** If the java expression has a receiver, we want to check whether
     ** it's null before evaluating the whole expression (to avoid
     ** a NullPointerException.
     */
    if (hasReceiver) {
      /*
       ** There is a receiver.  Generate a null SQL value to return
       ** in case the receiver is null.  First, create a field to hold
       ** the null SQL value.
       */
      String nullValueClass = getTypeCompiler().interfaceName();
      LocalField nullValueField = acb.newFieldDeclaration(Modifier.PRIVATE, nullValueClass);
      /*
       ** There is a receiver.  Generate the following to test
       ** for null:
       **
       **		(receiverExpression == null) ?
       */

      mb.conditionalIfNull();
      mb.getField(nullValueField);
      acb.generateNullWithExpress(mb, getTypeCompiler(), getTypeServices().getCollationType());

      /*
       ** We have now generated the expression to test, and the
       ** "true" side of the ?: operator.  Finish the "true" side
       ** so we can generate the "false" side.
       */
      mb.startElseCode();
    }

    resultType = getTypeId();
    TypeCompiler tc = getTypeCompiler();

    resultTypeName = tc.interfaceName();

    /* Allocate an object for re-use to hold the result of the conversion */
    LocalField field = acb.newFieldDeclaration(Modifier.PRIVATE, resultTypeName);

    /* Generate the expression for the Java value under us */
    javaNode.generateExpression(acb, mb);

    /* Generate the SQL value, which is always nullable */
    acb.generateDataValue(mb, tc, getTypeServices().getCollationType(), field);

    /*
     ** If there was a receiver, the return value will be the result
     ** of the ?: operator.
     */
    if (hasReceiver) {
      mb.completeConditional();
    }
  }