Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-108

Criteria addJoin causes incorrect SQL to be generated when optional schema references are in use (Oracle)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3-RC1, 3.3-RC2, 3.3-RC3
    • 4.0-beta1
    • Runtime
    • None
    • Linux, Java 1.6

    Description

      I previously wrote about this to torque-user in Oct 2007.

      In a schema definition that includes torque.dsfactory.programs.schema, writing the following

      Criteria crit = new Criteria();
      crit.addJoin(TransactionPeer.ORDER_ID, OrderPeer.ID);
      crit.add(TransactionPeer.ACCT_ID, account.getID());
      List<Order> orders = OrderPeer.doSelect(crit);

      generates

      SELECT <..ORDERS columns..> FROM TRANSACTION, ORDERS, DBSCHEMA.ORDERS, DBSCHEMA.TRANSACTION
      WHERE TRANSACTION.ORDER_ID=ORDERS.ID AND TRANSACTION.ACCT_ID= ?

      Upon examining the Torque code, it appears that SQLBuilder.processJoins does not add the full table names, while SQLBuilder.processCriterions does.
      Shouldn't they both add the full table names?

      Attachments

        1. joinbuilder.patch
          2 kB
          Brendan Miller
        2. JoinBuilderTest.java
          3 kB
          Brendan Miller

        Activity

          People

            tfischer Thomas Fox
            brmiller Brendan Miller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: