Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C96D8E751 for ; Wed, 23 Jan 2013 14:48:20 +0000 (UTC) Received: (qmail 69109 invoked by uid 500); 23 Jan 2013 14:48:20 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 68867 invoked by uid 500); 23 Jan 2013 14:48:15 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 68567 invoked by uid 99); 23 Jan 2013 14:48:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jan 2013 14:48:13 +0000 Date: Wed, 23 Jan 2013 14:48:13 +0000 (UTC) From: "gonzalad (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (OPENJPA-2327) QueryCache as hint MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 gonzalad created OPENJPA-2327: --------------------------------- Summary: QueryCache as hint Key: OPENJPA-2327 URL: https://issues.apache.org/jira/browse/OPENJPA-2327 Project: OpenJPA Issue Type: Bug Reporter: gonzalad Provide a way to enable query cache as a query hint. This would facilitate writing portable JPA applications. For the time being, with OpenJPA, we need to execute the following code to cache the query : {code:java} OpenJPAEntityManager oem = ((OpenJPAQuery) query).getEntityManager(); OpenJPAEntityManagerFactory oemf = oem.getEntityManagerFactory(); QueryResultCache qcache = oemf.getQueryResultCache(); qcache.pin(query); {code} It would be easier if JPA provided a query hint like : {code:java} query.setHint("openjpa.cacheable", cache); {code} This would even enable us to use it in a NamedQuery declaration : {code:java} @NamedQuery(name = "Civilite.findAll", query = "SELECT c FROM Civilite c", hints = @QueryHint(name = "openjpa.cacheable", value = "true")) {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira