コード例 #1
0
 /** INTERNAL: Select one object of any concrete subclass. */
 protected Object selectOneObject(ReadObjectQuery query) throws DescriptorException {
   ReadObjectQuery concreteQuery = (ReadObjectQuery) query.clone();
   Class javaClass = descriptor.getJavaClass();
   concreteQuery.setReferenceClass(javaClass);
   concreteQuery.setDescriptor(descriptor);
   return query.getSession().executeQuery(concreteQuery, concreteQuery.getTranslationRow());
 }
コード例 #2
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);
  }