Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 91754 invoked from network); 12 Jan 2007 19:57:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jan 2007 19:57:18 -0000 Received: (qmail 69511 invoked by uid 500); 12 Jan 2007 19:57:24 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 69489 invoked by uid 500); 12 Jan 2007 19:57:24 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 69480 invoked by uid 99); 12 Jan 2007 19:57:24 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jan 2007 11:57:24 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of ritikamster@gmail.com designates 64.233.166.180 as permitted sender) Received: from [64.233.166.180] (HELO py-out-1112.google.com) (64.233.166.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jan 2007 11:57:13 -0800 Received: by py-out-1112.google.com with SMTP id p76so459201pyb for ; Fri, 12 Jan 2007 11:56:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=cHBqJyQbwWW1ZK+6sRyWzTRE+uBKISysOubvKmg9K1FhjY/iMGFP+jZatb7YeMTYjnCEAv+CEaYxAXMDRmR8DtOqkZwWUrVR80AAqLsJ4gRsVdu+o/ph4xWWkBt0UthiogZ8pvtLXC64mgNGgcEmi9FThgnkrzBFjJZ+l11ybKg= Received: by 10.35.60.16 with SMTP id n16mr1778014pyk.1168631812893; Fri, 12 Jan 2007 11:56:52 -0800 (PST) Received: by 10.35.118.17 with HTTP; Fri, 12 Jan 2007 11:56:52 -0800 (PST) Message-ID: <7a5e6f6a0701121156o6a02dfd8hc572383c393f4499@mail.gmail.com> Date: Fri, 12 Jan 2007 11:56:52 -0800 From: "Ritika Maheshwari" To: open-jpa-dev Subject: pessimistic locking MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_32011_11435834.1168631812861" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_32011_11435834.1168631812861 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I have the following properties defined in my persistence.xml Even then the sql for the query em.createQuery("select object(o) from Neworders o where o.no_w_id=:warehouseId and o.no_d_id=:districtId ") does not have the With RS USE AND KEEP UPDATE LOCKS. However if I make the following change OpenJPAQuery qry = OpenJPAPersistence.cast(em.createQuery("select object(o) from Neworders o where o.no_w_id=:warehouseId and o.no_d_id=:districtId ")); qry.setParameter("warehouseId",wareHouseId); qry.setParameter("districtId",distId); qry.getFetchPlan().setReadLockMode(LockModeType.READ); newOrdersSet = qry.getResultList(); Then the sql generated has the WITH RS USE AND KEEP UPDATE LOCKS CLAUSE. So howcome JPA thinks it is in Optimistic mode even when the persistence.xmlsets LockManager to pessimitic and when you set the ReadLockMode on fetch plan then it thinks you are in pessimistic mode.Is there some misunderstanding or is this a bug.So essentially my question was that by just specifying the properties of Lock Manager and ReadLockMode in the persistence.xml all the queries generated by JPA should have had the Update Clause.But that did not happen.I had to specifically set the ReadLockMode on the Fetchplan of the query to make the Update clause appear. ritika ------=_Part_32011_11435834.1168631812861--