OpenJPA
  1. OpenJPA
  2. OPENJPA-1893

Missing join clause in query with collection-table with two join-columns

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1.0
    • Component/s: None
    • Labels:
      None

      Description

      Considering the following mapping:

      <entity class="Feature">
      <table name="features" />
      <attributes>
      <embedded-id name="id" />
      <element-collection name="attributes">
      <collection-table name="qualifiers" />
      </element-collection>
      </attributes>
      </entity>

      Without specifying any JoinColumn element in the CollectionTable element, I got the query:

      (...) INNER JOIN qualifiers t3 ON t0.index = t3.FEATURE_INDEX AND t0.oid = t3.FEATURE_OID (...)

      but changing the mapping by:
      <collection-table name="qualifiers">
      <join-column name="oid" />
      <join-column name="index" />
      </collection-table>

      I got:

      (...) INNER JOIN qualifiers t3 ON t0.index = t3.index (...)

      where is missing the first JoinColumn.

      1. FeatureId.java
        0.8 kB
        Patrice DUROUX
      2. Feature.java
        0.4 kB
        Patrice DUROUX
      3. Attribute.java
        0.3 kB
        Patrice DUROUX

        Activity

        Hide
        Fay Wang added a comment -

        Hi Patrice,
        Could you post your Feature.java, your embedded id class, and embeddable class used in the element collection? Thanks!

        Show
        Fay Wang added a comment - Hi Patrice, Could you post your Feature.java, your embedded id class, and embeddable class used in the element collection? Thanks!
        Hide
        Patrice DUROUX added a comment -

        Here are the corresponding Java classes.

        Show
        Patrice DUROUX added a comment - Here are the corresponding Java classes.

          People

          • Assignee:
            Fay Wang
            Reporter:
            Patrice DUROUX
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development