Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 2.0.0-M2
    • Fix Version/s: 1.3.0, 2.0.0-M3
    • Component/s: jdbc
    • Labels:
      None
    • Environment:
      Windows XP, openjpa-2.0.0 source code
    • Patch Info:
      Patch Available

      Description

      I had 2 entities, Person and Address where person had id, age, name and address_id and person had id and city.
      I tried to apply the Strategy on Address so that upon execution of JPQL query "Select p from Person p" the SQL query fired should make Inner Join rather than the default Left Outer Join.
      I created a Strategy class InnerJoinStrategy that makes sure this happens by overriding the selectEagerJoin() method and gave @Strategy(value = "somepackage.InnerJoinStrategy" ) in Person class before getAddress() method.
      But unexpectedly, it was still making the LeftOuterJoin rather than the desired InnerJoin. Upon debugging I found that my strategy was never being called. I debugged further and found that in AnnotationPersistenceMappingParser class in parseMemberMappingAnnotations() method, for the case STRAT( which belongs to the Strategy annotation) the strategy value was being set in ValueMappingInfo, while from RuntimeStrategyInstaller it was being fetched from FieldMappingInfo. I changed the code to set it in FieldMappingInfo and everything worked fine.

      1. testStrategyAnnotation.jar
        3 kB
        Ashish Paliwal
      2. OPENJPA-1116-2.0.0.patch
        7 kB
        Ashish Paliwal
      3. OPENJPA-1116-2.0.0(2).patch
        0.8 kB
        Ashish Paliwal

        Activity

        Hide
        Ashish Paliwal added a comment -

        The test case along with my InnerJoinStrategy and persistent entities person and Address.
        2 Patches:
        First for the dummy test case which I created to check the @strategy annotation,
        Second for the suggested change in AnnotationPersistenceMappingParser class.

        Show
        Ashish Paliwal added a comment - The test case along with my InnerJoinStrategy and persistent entities person and Address. 2 Patches: First for the dummy test case which I created to check the @strategy annotation, Second for the suggested change in AnnotationPersistenceMappingParser class.
        Hide
        Donald Woods added a comment -

        Code fixed in trunk in r808703 by Pinaki.
        Testcases added to trunk in r818212 and r818215.
        Code and testcases merged into 1.3.0 in r818217.

        Show
        Donald Woods added a comment - Code fixed in trunk in r808703 by Pinaki. Testcases added to trunk in r818212 and r818215. Code and testcases merged into 1.3.0 in r818217.

          People

          • Assignee:
            Pinaki Poddar
            Reporter:
            Ashish Paliwal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development