Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7A11E92D9 for ; Mon, 23 Jan 2012 12:57:16 +0000 (UTC) Received: (qmail 13307 invoked by uid 500); 23 Jan 2012 12:57:16 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 13111 invoked by uid 500); 23 Jan 2012 12:57:14 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 13103 invoked by uid 99); 23 Jan 2012 12:57:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2012 12:57:14 +0000 X-ASF-Spam-Status: No, hits=2.9 required=5.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [78.134.5.44] (HELO rovere.tirasa.net) (78.134.5.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2012 12:57:08 +0000 Received: from localhost (localhost [127.0.0.1]) by rovere.tirasa.net (Postfix) with ESMTP id 3FD691842F9 for ; Mon, 23 Jan 2012 13:56:47 +0100 (CET) X-Virus-Scanned: amavisd-new at tirasa.net Received: from rovere.tirasa.net ([127.0.0.1]) by localhost (rovere.tirasa.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EqLhNcQZ7q8X for ; Mon, 23 Jan 2012 13:56:41 +0100 (CET) Received: from [192.168.0.125] (unknown [192.168.0.125]) by rovere.tirasa.net (Postfix) with ESMTPSA id 1A3BE183696 for ; Mon, 23 Jan 2012 13:56:41 +0100 (CET) Message-ID: <4F1D5903.7070401@apache.org> Date: Mon, 23 Jan 2012 13:56:35 +0100 From: =?ISO-8859-1?Q?Francesco_Chicchiricc=F2?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: users@openjpa.apache.org Subject: Proper way to use query cache Content-Type: multipart/alternative; boundary="------------080509090801070502040401" X-Virus-Checked: Checked by ClamAV on apache.org --------------080509090801070502040401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Hi all, I was used (in Hibernate) to enable query cache on a per-query base by mean of query hints like as follows: Query query = entityManager.createQuery("SELECT e FROM " + SchemaMapping.class.getSimpleName() + " e"); query.setHint("javax.persistence.cache.retrieveMode", CacheRetrieveMode.USE); return query.getResultList(); Even though I've found this approach not for hibernate only (see [1], [2] and [3] for example), I've understood that OpenJPA does not support it (yet?). Now my question is: provided that I've set ENABLE_SELECTIVE and in my persistence unit, how can I activate query cache for a certain query? TIA. Regards. [1] http://en.wikibooks.org/wiki/Java_Persistence/Caching#JPA_2.0_Cache_APIs [2] http://wiki.eclipse.org/EclipseLink/Examples/JPA/Caching#How_to_refresh_the_cache [3] http://www.objectdb.com/java/jpa/persistence/cache -- Francesco Chicchiricc� Apache Cocoon Committer and PMC Member http://people.apache.org/~ilgrosso/ --------------080509090801070502040401--