mirror of
https://github.com/corda/corda.git
synced 2025-01-18 10:46:38 +00:00
ENT-10756: Use normal select count query for totalStatesAvailable (#7492)
Some DBs do not like the use of `distinct` in the count query for the `Page.totalStatesAvailable` result. It turns out it's not needed anyway and a non-distinct select count works as well.
This commit is contained in:
parent
fad7fcbd11
commit
fb4247d5c9
@ -771,7 +771,7 @@ class NodeVaultService(
|
||||
|
||||
private fun <T : ContractState> queryTotalStateCount(criteria: QueryCriteria, contractStateType: Class<out T>): Long {
|
||||
val (criteriaQuery, criteriaParser) = buildCriteriaQuery<Long>(criteria, contractStateType, null)
|
||||
criteriaQuery.select(criteriaBuilder.countDistinct(criteriaParser.vaultStates))
|
||||
criteriaQuery.select(criteriaBuilder.count(criteriaParser.vaultStates))
|
||||
val query = getSession().createQuery(criteriaQuery)
|
||||
return query.singleResult
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user