HHH-6846 lock timeout is in milliseconds
This commit is contained in:
parent
06f0a13ee3
commit
0c1569c4f4
|
@ -71,7 +71,7 @@ public abstract class QueryBinder {
|
|||
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 abstract class QueryBinder {
|
|||
}
|
||||
}
|
||||
|
||||
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() );
|
||||
|
|
|
@ -79,14 +79,14 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue