Uploaded image for project: 'JDO'
  1. JDO
  2. JDO-734

Ability to save a (created) query as a named query for later use

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • JDO 3.2
    • api, specification, tck
    • None

    Description

      When a user goes to the trouble of creating a query to retrieve some information it is a common enough scenario that this will need to be performed again during the application lifetime. Being able to save a query (once created) as a named query (in the PMF) would mean that applications can skip the generation step off for subsequent runs.

      Suggested API change would be to add a single method to Query.

      Query q = pm1.newQuery("SELECT p FROM Person p WHERE firstName == :param");
      q.saveAsNamedQuery("PeopleWithName");
      q.execute("John");

      ... (some time later)

      Query q = pm2.newNamedQuery(Person.class, "PeopleWithName");
      q.execute("Brian");

      Attachments

        1. SaveAsNamedQuery.java
          3 kB
          Andy Jefferson
        2. JDO-734.api.patch
          0.5 kB
          Andy Jefferson

        Activity

          People

            Unassigned Unassigned
            andyj Andy Jefferson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: