Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 25783 invoked from network); 5 Aug 2005 14:12:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Aug 2005 14:12:21 -0000 Received: (qmail 60082 invoked by uid 500); 5 Aug 2005 14:12:19 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 59858 invoked by uid 500); 5 Aug 2005 14:12:18 -0000 Mailing-List: contact ojb-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "OJB Users List" Reply-To: "OJB Users List" Delivered-To: mailing list ojb-user@db.apache.org Received: (qmail 59845 invoked by uid 99); 5 Aug 2005 14:12:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2005 07:12:17 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of glaforge@gmail.com designates 64.233.182.207 as permitted sender) Received: from [64.233.182.207] (HELO nproxy.gmail.com) (64.233.182.207) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2005 07:12:07 -0700 Received: by nproxy.gmail.com with SMTP id x4so141147nfb for ; Fri, 05 Aug 2005 07:12:14 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=PjfJrrCU9s2JTNvZHz4uB+MJsnINqjOiDJxtBIlrYs0DqiwzIn63Hhhma1UZ/UhG2R4PMCuUjMr7Gj1T40BPVjtX5YsEG8X8vd1SuR8qWsvUg14YkvM3rutAjkik7BzQhBBuXUzURQrkG8vwQpuO9GmY/UeXVRVtCvtNg5Ap0WQ= Received: by 10.48.1.18 with SMTP id 18mr100033nfa; Fri, 05 Aug 2005 07:12:14 -0700 (PDT) Received: by 10.48.237.8 with HTTP; Fri, 5 Aug 2005 07:12:13 -0700 (PDT) Message-ID: <197b18fc050805071223804ab8@mail.gmail.com> Date: Fri, 5 Aug 2005 16:12:13 +0200 From: Guillaume Laforge Reply-To: Guillaume Laforge To: OJB Users List Subject: PB and Oracle9i: transaction issue Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi all, I'm having some issues with the PersistenceBroker. I've got a one-to-many relationship, say a sentence, which has got localized labels (1 sentence <-> several multilingual labels). I want to store a new sentence with a new set of labels. But I want to do that in a single transaction, so that if something fails, I can rollback everything. So, somewhere in my code, I'm doing a broker.beginTransaction(). I store my sentence. I create some labels a bit further and store them. And later, broker.commitTransaction(). And in case something fails, I'm rollback-ing the transaction in some try catch finally surrounding my code. If autocommit is true, then my sentences and labels are stored... but, unfortunately, if something goes wrong, OJB won't rollback anything. So autocommit to true is not a good option for me since I want a real transaction (I also tried setting autocommit on the broker object itself but that wasn't any better). If I set useAutoCommit=3D"2" in my jdbc-connection-descriptor, I store my sentence, but just after I see a weird message in the logs: accesslayer.ConnectionManagerImpl - Release connection: connection is in local transaction, missing 'localCommit' or 'localRollback' call - try to rollback the connection And then, when I try to store the first label, I get an exception: org.apache.ojb.broker.KeyConstraintViolatedException: SQL failure while insert object data for class com.foo.bar.Xxxx, PK of the given object is [ id=3D201], object was xxxx, exception message is [ORA-02291: integrity constraint (AE6.SYS_C001821) violated - parent key not found. The message basically means that it can't find the sentence primary key that the label is referencing (foreign key). Background: I'm using OJB 1.0.3 and Oracle 9i with the thin driver. So, I was wondering how I could store a new sentence and label in on transaction and be able to rollback everything if I so desire? --=20 Guillaume Laforge http://glaforge.free.fr/blog/java --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org For additional commands, e-mail: ojb-user-help@db.apache.org