Skip to content

Conversation

mbellade
Copy link
Member

https://hibernate.atlassian.net/browse/HHH-19713

This is what the repository method looks like now:

long _totalResults =
		pageRequest.requestTotal()
				? _spec.createQuery(session)
					.getResultCount()
				: -1;
var _results = _spec.createQuery(session)
		.setFirstResult((int) (pageRequest.page()-1) * pageRequest.size())
		.setMaxResults(pageRequest.size())
		.getResultList();
return new PageRecord<>( pageRequest, _results, _totalResults);

And this is after this patch:

var _select = _spec.createQuery(session);
long _totalResults =
		pageRequest.requestTotal()
				? _select
					.getResultCount()
				: -1;
var _results = _select
		.setFirstResult((int) (pageRequest.page()-1) * pageRequest.size())
		.setMaxResults(pageRequest.size())
		.getResultList();
return new PageRecord<>( pageRequest, _results, _totalResults);

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@gavinking
Copy link
Member

I have no objections to this change, but I would say that HHH-19781 looks like the more serious bug.

@mbellade mbellade merged commit c5e483e into hibernate:main Sep 25, 2025
23 of 25 checks passed
@mbellade mbellade deleted the HHH-19713 branch September 25, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants