OpenJPA
  1. OpenJPA
  2. OPENJPA-956 OpenJPA 2.0 iteration 5 primary task
  3. OPENJPA-967

JPA2 Query support for selction of KEY, VALUE, ENTRY of a Map value

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.0-M2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Activity

      Catalina Wei created issue -
      Catalina Wei committed 751766 (44 files)
      Reviews: none

      OPENJPA-967 JPA2 Query support for selection of KEY, VALUE, ENTRY of a Map value
      more test scenarios for Map having @MapKeyClass or @MapKeyJoinColumn annotations

      openjpa trunk
      Hide
      Catalina Wei added a comment -

      In evaluating support for KEY(e),
      the following JPQL queries should be considiered not valid:

      1. select e from Dept d join d.emps e where KEY(e) IS NULL

      IS NULL predicate is for evaluating association fields.
      KEY(e) can be a basic type, an embeddable class, or an entity class; KEY(e) is not an association field.

      2. select KEY(e) from Dept d join d.emps e ORDER BY KEY(e)

      The JPA2 Spec says, order item should be a state_field_path_expression; KEY(e) is not a state_field_path_expression.

      The following query is valid ; KEY(e).address.city is a state_field_path_expression:

      select KEY(e) from Dept d join d.emps ORDER BY KEY(e).address.city

      3. select COUNT(KEY(e)) from Dept d join d.emps e GROUP BY KEY(e)

      a GROUP BY item requires an aggregate function in the selection list, but
      the KEY(e) is not allowed as an argument of COUNT function.

      The following query should be valid since KEY(e).address.city is a state_field_path_expression; a valid argument to COUNT and a valid group by item:

      select COUNT(KEY(e).address.city) from Dept d join d.emps e GROUP BY KEY(e).address.city

      Show
      Catalina Wei added a comment - In evaluating support for KEY(e), the following JPQL queries should be considiered not valid: 1. select e from Dept d join d.emps e where KEY(e) IS NULL IS NULL predicate is for evaluating association fields. KEY(e) can be a basic type, an embeddable class, or an entity class; KEY(e) is not an association field. 2. select KEY(e) from Dept d join d.emps e ORDER BY KEY(e) The JPA2 Spec says, order item should be a state_field_path_expression; KEY(e) is not a state_field_path_expression. The following query is valid ; KEY(e).address.city is a state_field_path_expression: select KEY(e) from Dept d join d.emps ORDER BY KEY(e).address.city 3. select COUNT(KEY(e)) from Dept d join d.emps e GROUP BY KEY(e) a GROUP BY item requires an aggregate function in the selection list, but the KEY(e) is not allowed as an argument of COUNT function. The following query should be valid since KEY(e).address.city is a state_field_path_expression; a valid argument to COUNT and a valid group by item: select COUNT(KEY(e).address.city) from Dept d join d.emps e GROUP BY KEY(e).address.city
      Catalina Wei committed 753473 (21 files)
      Reviews: none

      OPENJPA-967 JPA2 Query support for selection of state field thru KEY navigation
      Sample JPQL: select KEY(e).name from Dept d join d.emps e

      openjpa trunk
      Fay Wang committed 754773 (1 file)
      Reviews: none

      OPENJPA-967: remove duplicate column in the associate
      table when MapKey is specified.

      Catalina Wei committed 756151 (1 file)
      Reviews: none

      OPENJPA-967 add query test strings for JPA2 path nagivation thru KEY appear in FROM, WHERE, and ORDER BY clause

      Fay Wang committed 757670 (22 files)
      Reviews: none

      OPENJPA-967: Qualified Identifier in-memory query test cases

      openjpa trunk
      Catalina Wei made changes -
      Field Original Value New Value
      Status Open [ 1 ] Resolved [ 5 ]
      Fix Version/s 2.0.0 [ 12313483 ]
      Resolution Fixed [ 1 ]
      Hide
      Catalina Wei added a comment -

      The initial implementation for embeddable Map Key materialized the embeddable's owning entity,
      which from query result standpoint, is undesirable side effect.
      The revision r761851 has reworked on the support for embeddable Map Key.
      It is no longer materializing the owner entity of embeddable Map Keys.

      However, more rework is needed to move function performed in PCPath.selectEmbededMapKey() and loadEmbeddedMapKey() methods to relation's MapTableField strategies.

      Show
      Catalina Wei added a comment - The initial implementation for embeddable Map Key materialized the embeddable's owning entity, which from query result standpoint, is undesirable side effect. The revision r761851 has reworked on the support for embeddable Map Key. It is no longer materializing the owner entity of embeddable Map Keys. However, more rework is needed to move function performed in PCPath.selectEmbededMapKey() and loadEmbeddedMapKey() methods to relation's MapTableField strategies.
      Donald Woods made changes -
      Status Resolved [ 5 ] Closed [ 6 ]

        People

        • Assignee:
          Catalina Wei
          Reporter:
          Catalina Wei
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development