コード例 #1
0
  public void setup() {
    if (getSession().getPlatform().isDB2()) {
      throw new TestWarningException(
          "This test is not supposed to work with DB2. "
              + org.eclipse.persistence.internal.helper.Helper.cr()
              + "\t\tBecause as expected, sql string contains (t0.F_NAME = NULL) when the query is executed the second time with argument null, and '=NULL' is illegal syntax on DB2."
              + org.eclipse.persistence.internal.helper.Helper.cr()
              + "\t\tHence, executing the query would result in runtime exception.");
    }
    query =
        (ReadObjectQuery)
            getSession()
                .getDescriptor(
                    org.eclipse.persistence.testing.models.employee.domain.Employee.class)
                .getQueryManager()
                .getQuery("shouldPrepareQuery");

    queryCopy = (ReadObjectQuery) query.clone();
    ExpressionBuilder ex = new ExpressionBuilder();
    queryCopy.setSelectionCriteria(ex.get("firstName").equal(ex.getParameter("firstName1")));
    queryCopy.addArgument("firstName1");

    vec = new Vector();
    vec.add("Bob");
    getSession().executeQuery(queryCopy, vec);
  }
コード例 #2
0
 /** Return the string for logging purposes. */
 public String getLogString(Accessor accessor) {
   StringWriter writer = new StringWriter();
   writer.write("Executing ");
   writer.write(toString());
   writer.write(Helper.cr());
   writer.write("\tspec => ");
   writer.write(String.valueOf(getInteractionSpec()));
   writer.write(Helper.cr());
   writer.write("\tproperties => ");
   writer.write(String.valueOf(getProperties()));
   writer.write(Helper.cr());
   writer.write("\txml => ");
   Element dom = createInputDOM((EISAccessor) accessor);
   EISDOMRecord record = new EISDOMRecord(dom);
   record.transformToWriter(writer);
   return writer.toString();
 }
 /** INTERNAL: */
 public void startDocument(String encoding, String version) {
   try {
     writer.write("<?xml version=\"");
     writer.write(version);
     writer.write('\"');
     if (null != encoding) {
       writer.write(" encoding=\"");
       writer.write(encoding);
       writer.write('\"');
     }
     writer.write("?>");
     writer.write(Helper.cr());
   } catch (IOException e) {
     throw XMLMarshalException.marshalException(e);
   }
 }
コード例 #4
0
  /** INTERNAL: */
  public String toString() {
    StringWriter writer = new StringWriter();
    writer.write(Helper.getShortClassName(getClass()));
    writer.write("(");

    for (int index = 0; index < getFields().size(); index++) {
      writer.write(Helper.cr());
      writer.write("\t");
      writer.write(String.valueOf((getFields().elementAt(index))));
      writer.write(" => ");
      writer.write(String.valueOf((getValues().elementAt(index))));
    }
    writer.write(")");

    return writer.toString();
  }