OpenJPA
  1. OpenJPA
  2. OPENJPA-1277

Support JPQL to Criteria Query conversion

    Details

    • Type: New Feature New Feature
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: jpa, query
    • Labels:
      None

      Description

      Develop a mechanics to generate a Criteria Query from a JPQL string.

      A mechanics to convert an existing JPQL string into a Criteria Query will ease adoption of the new API.

      The conversion mechanics should operate both a design-time (to emit Java source code) as well as runtime (to instantiate of Criteria Query instances).

        Issue Links

          Activity

          Hide
          Hal Hildebrand added a comment -

          I would like to add +1 to this as well. We have the same use case in that we need to transform the original query to add dynamic and user specified security rules to the query. This is incredibly straight forward if we simply transform a tree based version. This is kind of a PITA if we have to do this ourselves.

          Show
          Hal Hildebrand added a comment - I would like to add +1 to this as well. We have the same use case in that we need to transform the original query to add dynamic and user specified security rules to the query. This is incredibly straight forward if we simply transform a tree based version. This is kind of a PITA if we have to do this ourselves.
          Hide
          Brad Koehn added a comment -

          I would love to have this feature. I have an application that needs to support generic, user-created, persistent queries (think reports). I'd love to give the user a UI that stores a JPQL query in the database. But when I run that query, I need to apply the (dynamic, also user-specified) security rules to the query. For this I'd love to have the user query in a Criteria format so that I can enhance it with whatever security filters are required. But since there's no good way to serialize a criteria query, translating JPQL to Criteria would be a great step.

          Show
          Brad Koehn added a comment - I would love to have this feature. I have an application that needs to support generic, user-created, persistent queries (think reports). I'd love to give the user a UI that stores a JPQL query in the database. But when I run that query, I need to apply the (dynamic, also user-specified) security rules to the query. For this I'd love to have the user query in a Criteria format so that I can enhance it with whatever security filters are required. But since there's no good way to serialize a criteria query, translating JPQL to Criteria would be a great step.
          Hide
          Pinaki Poddar added a comment -

          Nothing is done on this issue and was closed by oversight/mistake.

          The issue as it currently stands has no resolution.
          The implementation artifacts are available at runtime to achieve this goal.

          But what is unclear is the usage point of view for such a feature. It appears that such a feature should provide support more at design-time rather than at runtime. However the current JPA programming model is entirely based on runtime artifacts and has absolutely no design-time utility API. Unless that larger issue is addressed, it is not advisable to approach this specific problem in isolation.

          Show
          Pinaki Poddar added a comment - Nothing is done on this issue and was closed by oversight/mistake. The issue as it currently stands has no resolution. The implementation artifacts are available at runtime to achieve this goal. But what is unclear is the usage point of view for such a feature. It appears that such a feature should provide support more at design-time rather than at runtime. However the current JPA programming model is entirely based on runtime artifacts and has absolutely no design-time utility API. Unless that larger issue is addressed, it is not advisable to approach this specific problem in isolation.

            People

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

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 672h
                672h
                Remaining:
                Remaining Estimate - 672h
                672h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development