OpenJPA
  1. OpenJPA
  2. OPENJPA-1227

SQL generation error when using data cache

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3.0, 2.0.0-M3
    • Component/s: datacache, jdbc, sql
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      When the DataCacheStoreManager loads an object whose (table join strategy) superclass contains an eager to-many field, and this is the only field selected in the superclass, and when one or more fields are selected in the subclass, openjpa fails to create a join between the subclass and superclass.

        Activity

        Hide
        David Minor added a comment -
        Show
        David Minor added a comment - See http://n2.nabble.com/SQL-generation-error-td3379974.html for some discussion.
        Hide
        David Minor added a comment -

        The attached patch forces a join to the superclass table in the specific circumstances that I'm seeing the bug. However,

        1. The join is added to the base mapping select, but I am guessing it would be best to put it in the eager select only.
        2. While it only gets applied in the specific case I'm seeing, I don't understand the code well enough to know that it won't get applied in other cases which my application doesn't cover.

        Hopefully someone who understands this code better can use this patch to figure out what's triggering this particular bug, and come up with a more robust solution.

        Show
        David Minor added a comment - The attached patch forces a join to the superclass table in the specific circumstances that I'm seeing the bug. However, 1. The join is added to the base mapping select, but I am guessing it would be best to put it in the eager select only. 2. While it only gets applied in the specific case I'm seeing, I don't understand the code well enough to know that it won't get applied in other cases which my application doesn't cover. Hopefully someone who understands this code better can use this patch to figure out what's triggering this particular bug, and come up with a more robust solution.
        Hide
        David Minor added a comment -

        Test case patch against 1.2.1 which demonstrates the issue. Fetch groups turned out to be key to recreating.

        Show
        David Minor added a comment - Test case patch against 1.2.1 which demonstrates the issue. Fetch groups turned out to be key to recreating.
        Hide
        Donald Woods added a comment -

        Committed to trunk as r814706.
        Committed to 1.3.x as r814712.

        Mike/David, please reopen if you want to apply to other branches.

        Show
        Donald Woods added a comment - Committed to trunk as r814706. Committed to 1.3.x as r814712. Mike/David, please reopen if you want to apply to other branches.

          People

          • Assignee:
            Donald Woods
            Reporter:
            David Minor
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development