Skip to content

[#2106] Preserve KeysetAwarePage type for JPA Query Methods#2107

Draft
mj-p wants to merge 2 commits intoBlazebit:mainfrom
mj-p:keysetawarepage-converter-support
Draft

[#2106] Preserve KeysetAwarePage type for JPA Query Methods#2107
mj-p wants to merge 2 commits intoBlazebit:mainfrom
mj-p:keysetawarepage-converter-support

Conversation

@mj-p
Copy link
Copy Markdown

@mj-p mj-p commented Feb 26, 2026

Description

Fixes keyset page type loss during Spring Data result mapping for JPA query methods.

AbstractJpaQuery uses a ResultProcessor that maps slice/page results via Slice#map(...).
When the source is KeysetAwarePageImpl, inherited PageImpl#map(...) returns a plain PageImpl, which drops keyset-aware type information.

This change overrides map(...) in KeysetAwarePageImpl so mapped results remain KeysetAwarePageImpl, preserving keyset metadata and pageable semantics.

Related Issue

#2106

Motivation and Context

The runtime failure occurs in proxy/interceptor paths that expect KeysetAwarePage, after Spring Data re-materializes mapped results as PageImpl.

Observed exception:
java.lang.ClassCastException: org.springframework.data.domain.PageImpl cannot be cast to com.blazebit.persistence.spring.data.repository.KeysetAwarePage

By preserving the concrete keyset-aware page type in map(...), the expected runtime contract remains intact and keyset pagination metadata is retained.

@mj-p mj-p marked this pull request as draft February 28, 2026 11:07
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.

1 participant