Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HHH-6846 lock timeout is in milliseconds

  • Loading branch information...
commit 0c1569c4f4ade941398d749401f03fdf04306e35 1 parent 06f0a13
@stliu stliu authored
View
13 hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
@@ -71,7 +71,7 @@ public static void bindQuery(NamedQuery queryAnn, Mappings mappings, boolean isD
getBoolean( queryName, "org.hibernate.cacheable", hints ),
getString( queryName, "org.hibernate.cacheRegion", hints ),
getTimeout( queryName, hints ),
- getLockTimeout( queryName, hints),
+ getInteger( queryName, "javax.persistence.lock.timeout", hints ),
getInteger( queryName, "org.hibernate.fetchSize", hints ),
getFlushMode( queryName, hints ),
getCacheMode( queryName, hints ),
@@ -90,17 +90,6 @@ public static void bindQuery(NamedQuery queryAnn, Mappings mappings, boolean isD
}
}
- private static Integer getLockTimeout(String queryName, QueryHint[] hints) {
- Integer timeout = getInteger( queryName, "javax.persistence.lock.timeout", hints );
-
- if ( timeout != null ) {
- // convert milliseconds to seconds
- timeout = (int)Math.round(timeout.doubleValue() / 1000.0 );
- }
- return timeout;
- }
-
-
public static void bindNativeQuery(NamedNativeQuery queryAnn, Mappings mappings, boolean isDefault) {
if ( queryAnn == null ) return;
//ResultSetMappingDefinition mappingDefinition = mappings.getResultSetMapping( queryAnn.resultSetMapping() );
View
4 hibernate-entitymanager/src/matrix/java/org/hibernate/ejb/test/lock/LockTest.java
@@ -79,14 +79,14 @@ public void testTimeoutHint(){
assertEquals( 2000, timeout);
org.hibernate.ejb.QueryImpl q = (org.hibernate.ejb.QueryImpl) em.createQuery( "select u from UnversionedLock u" );
timeout = ((QueryImpl)q.getHibernateQuery()).getLockOptions().getTimeOut();
- assertEquals( 2, timeout );
+ assertEquals( 2000, timeout );
Query query = em.createQuery( "select u from UnversionedLock u" );
query.setLockMode(LockModeType.PESSIMISTIC_WRITE);
query.setHint( AvailableSettings.LOCK_TIMEOUT, 3000 );
q = (org.hibernate.ejb.QueryImpl)query;
timeout = ((QueryImpl)q.getHibernateQuery()).getLockOptions().getTimeOut();
- assertEquals( 3, timeout );
+ assertEquals( 3000, timeout );
em.getTransaction().rollback();
em.close();
}
Please sign in to comment.
Something went wrong with that request. Please try again.