Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 85260 invoked from network); 16 Nov 2003 10:25:00 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Nov 2003 10:25:00 -0000 Received: (qmail 98698 invoked by uid 500); 16 Nov 2003 10:24:33 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 98673 invoked by uid 500); 16 Nov 2003 10:24:33 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 98660 invoked from network); 16 Nov 2003 10:24:33 -0000 Received: from unknown (HELO smtp.web.de) (217.72.192.209) by daedalus.apache.org with SMTP; 16 Nov 2003 10:24:33 -0000 Received: from p50902b3f.dip.t-dialin.net ([80.144.43.63] helo=web.de) by smtp.web.de with asmtp (TLSv1:RC4-MD5:128) (WEB.DE 4.99 #516) id 1ALK5G-0008Rc-00 for ojb-dev@db.apache.org; Sun, 16 Nov 2003 11:24:46 +0100 Message-ID: <3FB75075.7060305@web.de> Date: Sun, 16 Nov 2003 11:24:53 +0100 From: Thomas Mahler Reply-To: thma@apache.org Organization: Apache Foundation User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821 X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: Problems with lock References: <000001c3abbd$5fdb1db0$3a8488c1@PLAINA> In-Reply-To: <000001c3abbd$5fdb1db0$3a8488c1@PLAINA> X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: thma32@web.de X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi Jo�o, The problem is that using two different objects with the same primary key violates the relational calculus, and OJB refuses to work that way! If you use a1.setName("this should be in database after commit"); the changes will be persisted to the database. Jo�o Vieira da Luz wrote: > Hi, > > Look to this pseudo-code: > > beginTransaction(); // odmg transaction > > A a1 = readByPk(new Integer(1)); //using Persistence Broker Api > > lock Read Object a1 //using tx > > A a2 = new A(); > > a2.setIdInternal(new Integer(1)); // idInternal is the primary > key > > lock write object a2 As Object a1 is already locked with the same Identity the second registration for the same Identity is ignored, as OJB relies on the fact that instances have unique Identities ! cheers, thomas > > a2.setName("this should be in database after commit"); > > commitTransaction(); //using tx > > My question is why attribute name is not updated on database? > > Thanks, > Jo�o > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org