Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 24688 invoked from network); 3 Mar 2010 23:38:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Mar 2010 23:38:58 -0000 Received: (qmail 28446 invoked by uid 500); 3 Mar 2010 23:38:49 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 28413 invoked by uid 500); 3 Mar 2010 23:38:49 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 28405 invoked by uid 99); 3 Mar 2010 23:38:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 23:38:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 23:38:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2A99D234C4BB for ; Wed, 3 Mar 2010 23:38:27 +0000 (UTC) Message-ID: <1465796764.50741267659507162.JavaMail.jira@brutus.apache.org> Date: Wed, 3 Mar 2010 23:38:27 +0000 (UTC) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Resolved: (OPENJPA-1142) OptimisticLockException thrown on Query.getResultList() when Pessimistic Lock is applied In-Reply-To: <339008648.1245696727946.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Albert Lee resolved OPENJPA-1142. --------------------------------- Resolution: Fixed Fix Version/s: 2.0.0-beta2 > OptimisticLockException thrown on Query.getResultList() when Pessimistic Lock is applied > ---------------------------------------------------------------------------------------- > > Key: OPENJPA-1142 > URL: https://issues.apache.org/jira/browse/OPENJPA-1142 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 2.0.0-M2, 2.0.0 > Reporter: Albert Lee > Assignee: Albert Lee > Fix For: 2.0.0, 2.0.0-beta2 > > Attachments: OPENJPA-1142.patch > > > The following sample code snippet may yield a OptimisticLockException. > Query tc_query = itemManager.createNamedQuery("TypeCategory.find_tc").setParameter("product_id", new Integer(product_id)); > tc_query.setLockMode(LockModeType.PESSIMISTIC_READ); > Collection typeCat = tc_query.getResultList(); > This is a incorrect behavior per JPA 2.0 spec: > public interface Query { > /** > * Execute a SELECT query and return the query results > * as an untyped List. > * @return a list of the results > * @throws IllegalStateException if called for a Java Persistence query language UPDATE or DELETE statement > * @throws QueryTimeoutException if the query execution exceeds the query timeout value set > * @throws TransactionRequiredException if a lock mode has been set and there is no transaction > * @throws PessimisticLockException if pessimistic locking fails and the transaction is rolled back > * @throws LockTimeoutException if pessimistic locking fails and only the statement is rolled back > */ > List getResultList(); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.