[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4661) Properly propagate Query.setLockMode to Hibernate Core

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Jan 25 04:29:32 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35324#action_35324 ] 

Emmanuel Bernard commented on HHH-4661:
---------------------------------------

The spec says
3.8.8 Queries and Lock Mode
The setLockMode method of the Query or TypedQuery interface or the lockMode element of the NamedQuery annotation may be used to lock the results of a query. A lock is obtained for each entity specified in the query result (including entities passed to constructors in the query SELECT clause).[48]
If	the	lock	mode	type	is	PESSIMISTIC_READ,	PESSIMISTIC_WRITE,	or PESSIMISTIC_FORCE_INCREMENT, and the query returns scalar data (e.g., the values of entity field or properties, including scalar data passed to constructors in the query SELECT clause), the under- lying database rows will be locked[49], but the version columns (if any) for any entities corresponding to such scalar data will not be updated unless the entities themselves are also otherwise retrieved and updated.
If the lock mode type is OPTIMISTIC or OPTIMISTIC_FORCE_INCREMENT, and the query returns scalar data, any entities returned by the query will be locked, but no locking will occur for scalar data that does not correspond to the state of any entity instance in the query result.
If a lock mode other than NONE is specified for a query, the query must be executed within a transaction or the TransactionRequiredException will be thrown.
Locking is supported for Java Persistence query language queries and criteria queries only. If the set- LockMode or getLockMode method is invoked on a query that is not a Java Persistence query lan- guage select query or a criteria query, the IllegalStateException may be thrown or the query execution will fail.

> Properly propagate Query.setLockMode to Hibernate Core
> ------------------------------------------------------
>
>                 Key: HHH-4661
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4661
>             Project: Hibernate Core
>          Issue Type: Sub-task
>          Components: entity-manager
>            Reporter: Emmanuel Bernard
>             Fix For: 3.5.0-Beta-4
>
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list