Upgrade hibernate and fix tests

CORDA-1947 Address code review changes

CORDA-1947 Address code review changes
This commit is contained in:
Tudor Malene 2018-09-26 16:05:57 +01:00 committed by tudor.malene@gmail.com
parent 7902d758bd
commit ab98c03d1a
3 changed files with 23 additions and 9 deletions

View File

@ -43,7 +43,7 @@ buildscript {
ext.hamkrest_version = '1.4.2.2'
ext.jopt_simple_version = '5.0.2'
ext.jansi_version = '1.14'
ext.hibernate_version = '5.2.6.Final'
ext.hibernate_version = '5.3.6.Final'
ext.h2_version = '1.4.197' // Update docs if renamed or removed.
ext.postgresql_version = '42.1.4'
ext.rxjava_version = '1.2.4'

View File

@ -1,14 +1,8 @@
package net.corda.nodeapi.internal.persistence
import org.hibernate.stat.*
import javax.management.MXBean
import org.hibernate.stat.Statistics
import org.hibernate.stat.SecondLevelCacheStatistics
import org.hibernate.stat.QueryStatistics
import org.hibernate.stat.NaturalIdCacheStatistics
import org.hibernate.stat.EntityStatistics
import org.hibernate.stat.CollectionStatistics
/**
* Exposes Hibernate [Statistics] contract as JMX resource.
*/
@ -20,6 +14,25 @@ interface StatisticsService : Statistics
* session factory.
*/
class DelegatingStatisticsService(private val delegate: Statistics) : StatisticsService {
override fun getNaturalIdStatistics(entityName: String?): NaturalIdStatistics {
return delegate.getNaturalIdStatistics(entityName)
}
override fun getDomainDataRegionStatistics(regionName: String?): CacheRegionStatistics {
return delegate.getDomainDataRegionStatistics(regionName)
}
override fun getQueryRegionStatistics(regionName: String?): CacheRegionStatistics {
return delegate.getQueryRegionStatistics(regionName)
}
override fun getNaturalIdQueryExecutionMaxTimeEntity(): String {
return delegate.getNaturalIdQueryExecutionMaxTimeEntity()
}
override fun getCacheRegionStatistics(regionName: String?): CacheRegionStatistics {
return delegate.getCacheRegionStatistics(regionName)
}
override fun clear() {
delegate.clear()

View File

@ -480,7 +480,8 @@ class NodeVaultService(
// Even if we set the default pageNumber to be 1 instead, that may not cover the non-default cases.
// So the floor may be necessary anyway.
query.firstResult = maxOf(0, (paging.pageNumber - 1) * paging.pageSize)
query.maxResults = paging.pageSize + 1 // detection too many results
val pageSize = paging.pageSize + 1
query.maxResults = if (pageSize > 0) pageSize else Integer.MAX_VALUE // detection too many results, protected against overflow
// execution
val results = query.resultList