Return-Path: Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 55436 invoked from network); 17 Feb 2003 14:27:04 -0000 Received: from unknown (HELO srv002.hpd.co.uk) (212.158.99.130) by daedalus.apache.org with SMTP; 17 Feb 2003 14:27:04 -0000 Message-ID: <6FB083FB72EFD21181D30004AC4CA18A01C8F2BA@srv002> From: Charles Anthony To: 'OJB Developers List' Subject: RE: Problem with implicitLocking and object modifications. Date: Mon, 17 Feb 2003 14:26:38 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Once More ! OK; like someone else today, the file which was attached was stripped. Here is the test method to be added to org.apache.ojb.odmg.UserTestCases Cheers, Charles. public void testImplicitLocking() throws Exception{ Implementation odmg = OJB.getInstance(); Database db = odmg.newDatabase(); String name = "testImplicitLocking - " + System.currentTimeMillis(); /* Create an object */ db.open(databaseName, Database.OPEN_READ_WRITE); Site site = new Site(); site.setName(name); Transaction tx = odmg.newTransaction(); tx.begin(); tx.lock(site, Transaction.WRITE); tx.commit(); /* Retrieve from the object created, and set the year*/ OQLQuery query = odmg.newOQLQuery(); query.create("select sites from " + Site.class.getName() + " where name=$1"); query.bind(name); tx.begin(); List result = (List) query.execute(); assertEquals(1,result.size()); site = (Site) result.get(0); assertNotNull(site); assertNull(site.getYear()); site.setYear(new Integer(2003)); tx.lock(site, Transaction.UPGRADE); tx.commit(); /* Flush the cache, and retrieve the object again */ query = odmg.newOQLQuery(); query.create("select sites from " + Site.class.getName() + " where name=$1"); query.bind(name); tx.begin(); ((HasBroker) tx).getBroker().clearCache(); result = (List) query.execute(); assertEquals(1,result.size()); site = (Site) result.get(0); assertNotNull(site); assertNotNull("year should not be null", site.getYear()); tx.commit(); db.close(); } >-----Original Message----- >From: Charles Anthony [mailto:charles.anthony@hpdsoftware.com] >Sent: 17 February 2003 14:22 >To: 'ojb-dev@db.apache.org' >Subject: Problem with implicitLocking and object modifications. > > >Hi All, > >I think I've uncovered a bug in the ODMG layer. > >Up to now, we've been just using the broker layer. I now have a usecase >where we will need to use the ODMG layer. We do not want to >use implicit >locking; I want my developers to explicit lock each object to an ODMG >transaction (implicit locking generates loads of queries for >all the proxy >collections). > >It seems that something 'funny' happens if implicit locking is >turned off - >objects are not marked as being "dirty" when changed - even >when they are >explicitly lock to the transaction. > >As I am a complete novice in the ways of the ODMG, I don't >really know where >to look to sort this issue out so I have added a new test method to >org.apache.ojb.odmg.UserTestCases (it should be attached to >this email). >Essentially, it creates an object and persists it; retrieves >and updates it; >then flushes the cache, and retrieves it again to ensure the >update worked. >If ImplicitLocking is TRUE, the test passes. If >ImplicitLocking is FALSE, >the test fails. > >I think this is incorrect, and would dearly like this to be resolved. > >Could somone either confirm this is a bug, or tell me what I am doing >wrong... > >If anything else is needed, please let me know. > >Cheers, > >Charles > > >This email and any attachments are strictly confidential and >are intended >solely for the addressee. If you are not the intended >recipient you must >not disclose, forward, copy or take any action in reliance on >this message >or its attachments. If you have received this email in error >please notify >the sender as soon as possible and delete it from your >computer systems. >Any views or opinions presented are solely those of the author >and do not >necessarily reflect those of HPD Software Limited or its affiliates. > > At present the integrity of email across the internet cannot >be guaranteed >and messages sent via this medium are potentially at risk. >All liability >is excluded to the extent permitted by law for any claims >arising as a re- >sult of the use of this medium to transmit information by or to >HPD Software Limited or its affiliates. > > > > > > This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates.