[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6846) Support for Query.setHint(javax.persistence.lock.timeout)

Christian Bauer (JIRA) noreply at atlassian.com
Thu Nov 24 10:39:19 EST 2011


Support for Query.setHint(javax.persistence.lock.timeout)
---------------------------------------------------------

                 Key: HHH-6846
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6846
             Project: Hibernate Core
          Issue Type: New Feature
            Reporter: Christian Bauer
            Priority: Minor


"This hint may be used with the methods of the EntityManager interface that allow lock modes to be specified, the Query.setLockMode method and the NamedQuery annotation."

List<Item> items =
        em.createQuery("select i from Item i where i.category.id = :catId")
                .setLockMode(LockModeType.PESSIMISTIC_WRITE)
                .setParameter("catId", categoryId)
                .setHint("javax.persistence.lock.timeout", 5000) // Currently ignored!
                .getResultList();

This should be quite easy to implement:

- org.hibernate.ejb.AbstractQueryImpl#setHint() needs to recognize the new property
- similar to the abstract applyTimeout() a new method applyLockTimeout() can be added
- the implementation in org.hibernate.ejb.QueryImpl calls the org.hibernate.Query.setLockOptions(...) method on its delegate




--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list