Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC172653A for ; Thu, 16 Jun 2011 16:49:58 +0000 (UTC) Received: (qmail 59800 invoked by uid 500); 16 Jun 2011 16:49:58 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 59787 invoked by uid 500); 16 Jun 2011 16:49:58 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 59779 invoked by uid 99); 16 Jun 2011 16:49:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 16:49:58 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 209.85.210.171 is neither permitted nor denied by domain of mailinglist@nesluop.dk) Received: from [209.85.210.171] (HELO mail-iy0-f171.google.com) (209.85.210.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 16:49:52 +0000 Received: by iyi12 with SMTP id 12so511435iyi.16 for ; Thu, 16 Jun 2011 09:49:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.63.198 with SMTP id c6mr932228ibi.159.1308242970928; Thu, 16 Jun 2011 09:49:30 -0700 (PDT) Received: by 10.231.43.9 with HTTP; Thu, 16 Jun 2011 09:49:30 -0700 (PDT) X-Originating-IP: [93.167.176.210] In-Reply-To: <4DFA2317.7020601@holos.pt> References: <4DFA2317.7020601@holos.pt> Date: Thu, 16 Jun 2011 18:49:30 +0200 Message-ID: Subject: Re: Oracle Sequences & Cache From: Chris Poulsen To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=000e0cd571f28fe79c04a5d70d48 --000e0cd571f28fe79c04a5d70d48 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Bruno, We've had issues at work related to caching of sequence values on oracle if I recall correctly. We're using cayenne 3. As we're not doing bulk inserts through cayenne, we decided to simply extract one key at the time (not cache). The following xml snippet shows ho= w we configure the db-key-generator to do this (IIRC setting the cache-size t= o 0 fails, even though would I find that the intuitive way to tell cayenne no= t to cache the key): ORACLE PK_CONTACT_PERSON_KEY_SEQ 1 Using an insert "returning" a trigger generated key instead of the key-generator stuff would be a nice (returning is supported since Oracle 10.2 or something like that). But I don't know if it would be a trivial change to cayenne. Hope this helps. --=20 Regards Chris On Thu, Jun 16, 2011 at 5:36 PM, Bruno Ren=E9 Santos wr= ote: > Hello all, > > We had a problem on one of our applications on Oracle because, we think, = of > the cayenne cache and we wanted to have some sort of confirmation if we a= re > seeing this correctly... > > On Oracle, in order to get the next PK we need to execute the query: > > Select sequence_name.next_val from DUAL > > Sometimes the query logger did not print this command before an INSERT. > After some testing we reached to the conclusion that this was a cache iss= ue > and so we overrode CommitChanges and CommitChangesToParent in order to cl= ear > the query cache after the commit phase, like this: > > @Override > public void commitChanges() throws CayenneRuntimeException { > super.commitChanges(); > getQueryCache().clear(); > } > > @Override > public void commitChangesToParent() { > super.commitChangesToParent(); > getQueryCache().clear(); > } > > We think this is a bug because on the PK generation phase on cayenne no > data, always, should be ever retrieved from the cache, which would lead t= o > repeated primary keys... > > Can this be true? > > Thanx > Bruno > -- > Bruno Ren=E9 Santos | brunorene@holos.pt | > Gestor de Projectos | Analista | Programador | Investigador > > Holos - Solu=E7=F5es Avan=E7adas em Tecnologias de Informa=E7=E3o S.A. > Parque de Ci=EAncia e Tecnologia de Almada/Set=FAbal . Edif=EDcio Madan P= arque > Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal > Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt > > > This email and any files transmitted with it are confidential and intende= d > solely for the use of the individual or entity to whom they are addressed= . > If you are not the intended recipient or the person responsible for > delivering the email to the intended recipient, be advised that you have > received this email in error and that any use, dissemination, forwarding, > printing, or copying of this email is strictly prohibited. If you have > received this email in error please notify Bruno Ren=E9 Santos by telepho= ne on > +351 210 438 686 > > --000e0cd571f28fe79c04a5d70d48--