[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1474#comment-1474 ] Michael Bouschen commented on JDO-734: -- I don't think there is anything left, so marking it as resolved is fine. > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch, SaveAsNamedQuery.java > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14735308#comment-14735308 ] Andy Jefferson commented on JDO-734: Spec update is in SVN as is this test. Any more to do? otherwise mark as resolved > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch, SaveAsNamedQuery.java > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14563673#comment-14563673 ] Michael Bouschen commented on JDO-734: -- For dynamic fetch groups the PMF methods addFetchGroups, removeFetchGroups and removeAllFetchGroups require the manageMetadata JDOPermission. I think PMF.registerMetadata and the new method Query.saveAsNamedQuery should behave the same, meaning they should throw a SecurityException if the caller is not authorized for JDOPermission("manageMetadata"). > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14512926#comment-14512926 ] Andy Jefferson commented on JDO-734: Each application, in general, would have its own PMF, so they wouldn't be using the same namespace. If two applications were using the same namespace then, if we think this is a problem, we ought to address the same concern on dynamic metadata creation and dynamic fetch groups. > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14511327#comment-14511327 ] Craig L Russell commented on JDO-734: - How do we avoid applications fighting over the same named query? Shouldn't we have some authorization to change the definition of a query? > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501385#comment-14501385 ] Andy Jefferson commented on JDO-734: Query updated in SVN to add the method. > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501381#comment-14501381 ] Andy Jefferson commented on JDO-734: I prefer just a single method and for it to replace any existing named query with that name. If we go into the domain of informing people of overwriting existing named queries then we'd really have to provide a method to get the names of current named queries also, and would like to keep this as a cheap and cheerful option. Note also, JPA opts for putting this (type of) method on the EMF, whereas I've gone via the Query object. The reason for this is clear (to me at least), the user is playing around with a Query in their code, and they don't want to have to navigate down to the PMF just to save it. > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (JDO-734) Ability to save a (created) query as a named query for later use
[ https://issues.apache.org/jira/browse/JDO-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14394957#comment-14394957 ] Craig L Russell commented on JDO-734: - The API itself looks good. Two comments: Do we want to allow replacing an existing named query with the new one? Do we want two APIs, one to replace and one to add? The API would change the state of the PersistenceManagerFactory so it should require some permissions. Perhaps manageMetadata is the right permission? So any JDO implementation should make this check and the tck should verify it. > Ability to save a (created) query as a named query for later use > > > Key: JDO-734 > URL: https://issues.apache.org/jira/browse/JDO-734 > Project: JDO > Issue Type: New Feature > Components: api, specification, tck >Reporter: Andy Jefferson > Fix For: JDO 3.2 > > Attachments: JDO-734.api.patch > > > 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"); -- This message was sent by Atlassian JIRA (v6.3.4#6332)