Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5031 Make AS5 compile/run under Java6
  3. JBAS-5497

JDK6: org.jboss.test.cmp2.commerce.QueryTest#testEJBQL

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Done
    • Major
    • JBossAS-5.0.0.CR1
    • None
    • None
    • None

    Description

      This tests has several assertions verifying the compilation of EJB-QL to SQL using org.jboss.ejb.plugins.cmp.jdbc.compileEJBQL() t. With JavaSE6 there are two EJB-QL queries that use the conditional AND expression in the WHERE clause. The expected result does not match the generated SQL causing the assertion failures. The generated SQL, after review, has been determined to generate the same query result. Therefore, the tests were adjusted to pass on either condition. This issue has been seen before as one of the cases has already been conditionlized but tests for javaVersion "1.4".

      1)
      JDK 5:
      assertEquals("SELECT t0_l.id FROM CUSTOMEREJB t1_c, ORDER_DATA t3_o, LINEITEMEJB t0_l " +
      "WHERE ((t1_c.id = 1)) AND t1_c.id=t3_o.customer AND t3_o.ORDER_NUMBER=t0_l.ORDER_NUMBER",
      compileEJBQL("SELECT OBJECT(l) FROM Customer c, IN(c.orders) o, IN(o.lineItems) l WHERE c.id=1"));

      else {
      assertEquals("SELECT t0_l.id FROM CUSTOMEREJB t1_c, ORDER_DATA t3_o, LINEITEMEJB t0_l " +
      "WHERE ((t1_c.id = 1)) AND t3_o.ORDER_NUMBER=t0_l.ORDER_NUMBER AND t1_c.id=t3_o.customer",
      compileEJBQL("SELECT OBJECT(l) FROM Customer c, IN(c.orders) o, IN(o.lineItems) l WHERE c.id=1"));
      }

      2)

      • String expected = "1.4".equals(javaVersion) ?
        + String expected = "1.5".equals(javaVersion) ?
        "SELECT t0_o.ORDER_NUMBER " +
        "FROM ORDER_DATA t0_o, LINEITEMEJB t4_l, PRODUCTCATEGORYEJB t1_pc, PRODUCT_PRODUCT_CATEGORY t5_l_product_productCategories_R, PRODUCT t6_l_product " +
        "WHERE (((t0_o.ORDER_NUMBER = ? AND t1_pc.name = ?))) " +
        "AND t6_l_product.id=t5_l_product_productCategories_R.PRODUCT_ID " +
        "AND t1_pc.id=t5_l_product_productCategories_R.PRODUCT_CATEGORY_ID " +
        "AND t1_pc.subId=t5_l_product_productCategories_R.PRODUCT_CATEGORY_SUBID " +
        "AND t4_l.product=t6_l_product.id AND t0_o.ORDER_NUMBER=t4_l.ORDER_NUMBER" :
        "SELECT t0_o.ORDER_NUMBER " +
        "FROM ORDER_DATA t0_o, LINEITEMEJB t4_l, PRODUCTCATEGORYEJB t1_pc, PRODUCT_PRODUCT_CATEGORY t5_l_product_productCategories_R, PRODUCT t6_l_product " +
        "WHERE (((t0_o.ORDER_NUMBER = ? AND t1_pc.name = ?))) " +
        "AND t0_o.ORDER_NUMBER=t4_l.ORDER_NUMBER " +
        "AND t6_l_product.id=t5_l_product_productCategories_R.PRODUCT_ID " +
        "AND t1_pc.id=t5_l_product_productCategories_R.PRODUCT_CATEGORY_ID " +
        "AND t1_pc.subId=t5_l_product_productCategories_R.PRODUCT_CATEGORY_SUBID " +
        "AND t4_l.product=t6_l_product.id";

      Attachments

        Issue Links

          Activity

            People

              smcgowan@redhat.com Shelly McGowan (Inactive)
              smcgowan@redhat.com Shelly McGowan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: