openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-1142) OptimisticLockException thrown on Query.getResultList() when Pessimistic Lock is applied
Date Tue, 23 Jun 2009 02:24:07 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Lee updated OPENJPA-1142:
--------------------------------

    Attachment: OPENJPA-1142.patch

> 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
>
>         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.


Mime
View raw message