[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5027) javax.persistence.lock.timeout ignored by EntityManager#find method

Adrian Hummel (JIRA) noreply at atlassian.com
Mon Mar 22 12:17:31 EDT 2010


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

Adrian Hummel commented on HHH-5027:
------------------------------------

BTW: The lock method does only support the timeout when used with {{PESSIMISTIC_WRITE}} (i.e. the {{PessimisticWriteSelectLockingStrategy}}) but not with {{PESSIMISTIC_FORCE_INCREMENT}}:

{code}
lock(entity, LockModeType.PESSIMISTIC_FORCE_INCREMENT, props);
{code}

The {{PessimisticForceIncrementLockingStrategy}} ignores the timeout parameter.

> javax.persistence.lock.timeout ignored by EntityManager#find method
> -------------------------------------------------------------------
>
>                 Key: HHH-5027
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5027
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: entity-manager
>    Affects Versions: 3.5.0-CR-2
>         Environment: Oracle 10g XE
>            Reporter: Adrian Hummel
>
> The EntityManager *lock* method does support the {{javax.persistence.lock.timeout}} property whereas the *find* method does not:
> Works:
> {code}
> Map<String, Object> props = new HashMap<String, Object>();
> props.put("javax.persistence.lock.timeout", 4000);
> em.lock(entity, LockModeType.PESSIMISTIC_WRITE, props); // select ... update wait 4
> {code}
> Does not work:
> {code}
> Map<String, Object> props = new HashMap<String, Object>();
> props.put("javax.persistence.lock.timeout", 4000);
> em.find(MyEntity.class, pk, LockModeType.PESSIMISTIC_WRITE, props); // select ... update 
> {code}
> Note: setting the property by means of the persistence.xml (instead of passing as property map) had no effect in both situations.

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