Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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");