Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1996

Adding a prefetch to a SelectQuery via string path doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 4.0.M2
    • None
    • Core Library
    • None
    • MySQL 5.5.40-MariaDB-36.1, InnoDB, Mac OS X 10.10, Java 8u40 (build 1.8.0_40-b27)

    Description

      Adding a prefetch to a selectQuery via the relationship's name only doesn't seem to work.
      Entity "SMReceipt" has a to-one relationship "shop" to the entity "SMShop". The first fetch performs a prefetch as expceted, the second fetch performs no prefetching.

      ----------------------------------
      FETCH 1 (working)
      ----------------------------------
      SelectQuery<DataRow> q = SelectQuery.dataRowQuery( SMReceipt.class );
      q.addPrefetch( SMReceipt.SHOP.joint() );
      List<DataRow> list = objectContext.select( q );
      ----------------------------------
      GENERATED SQL
      ----------------------------------
      SELECT t0.creation_date, t0.date, t0.modification_date, t0.shop_id, t0.storage_number, t0.text, t0.user_id, t0.id, t1.CITY_ID, t1.LOCATION, t1.NAME, t1.CHAIN_ID, t1.SHOP_ID FROM strimillinn.fd_receipt t0 LEFT JOIN strimillinn.fd_shop t1 ON (t0.shop_id = t1.SHOP_ID)

      ----------------------------------
      FETCH 2 (not working)
      ----------------------------------
      SelectQuery<DataRow> q = SelectQuery.dataRowQuery( SMReceipt.class );
      q.addPrefetch( SMReceipt.SHOP.getName() );
      List<DataRow> list = objectContext.select( q );
      ----------------------------------
      GENERATED SQL
      ----------------------------------
      SELECT t0.creation_date, t0.date, t0.modification_date, t0.shop_id, t0.storage_number, t0.text, t0.user_id, t0.id FROM strimillinn.fd_receipt t0

      Attachments

        Activity

          People

            SavvaKolbachev Savva Kolbachev
            hugi Hugi Thordarson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: