spring-projects / spring-projects/spring-data-jpa
Kotlin is-prefixed Boolean properties fail in derived queries with JPA property access
@mp911de is already working on this.
Since Aug 3, 2026.
- Dominant language
- Java
- Stars
- 3.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
A Kotlin Boolean property whose name starts with is cannot be used in a derived query when the entity uses JPA property access.
Versions
Reproduced with:
- Spring Boot 4.1.0, Spring Data JPA 4.1.0, Hibernate 7.4.1.Final, Kotlin 2.3.21
- Spring Boot 4.0.7, Spring Data JPA 4.0.6, Hibernate 7.2.19.Final, Kotlin 2.2.21
Both setups use Java 17, H2, and kotlin-reflect.
Reproducer
https://github.com/SHEOMM/spring-data-jpa-kotlin-is-prefix-repro (tested at tag repro-2026-07-23)
./gradlew clean test printVersions
./gradlew clean test printVersions -PspringBootVersion=4.0.7 -PkotlinVersion=2.2.21
What happens
The entity uses property-access mapping:
@Entity
class PropertyAccessSample(
@get:Id var id: Long = 0,
@get:Column(nullable = false) var isActive: Boolean = false,
@get:Column var isVerified: Boolean? = null,
)
The layers expose different names for the property:
| Layer | isActive seen as |
isVerified seen as |
|---|---|---|
Kotlin property / KProperty.name |
isActive |
isVerified |
| JVM getter | isActive() |
isVerified() |
Spring Data (KotlinBeanInfoFactory, PropertyPath) |
isActive |
isVerified |
| JPA property-access metamodel | active |
verified |
findByActiveTrue() fails during query creation with a QueryCreationException caused by a PropertyReferenceException, because Spring Data's property model has no active property. findByIsActiveTrue() parses, but the generated JPQL references p.isActive; execution fails with a BadJpqlGrammarException whose cause chain contains Hibernate's UnknownPathException, because the JPA metamodel attribute is named active. The nullable findByIsVerifiedTrue() case produces the same failure for p.isVerified, so the mismatch is not limited to primitive boolean.
Expected behavior
findByIsActiveTrue() should resolve to the JPA metamodel attribute active. Because KotlinBeanInfoFactory intentionally exposes the property as isActive (spring-projects/spring-data-commons#3127), the names should be reconciled while resolving the JPA path rather than by adding an active alias in Spring Data Commons.
See #4305 for a proposed implementation.
Prior issues
I found related accessor and projection issues, but no duplicate covering derived-query paths: spring-projects/spring-data-commons#3127, spring-projects/spring-data-jpa#3771, spring-projects/spring-data-commons#3215, spring-projects/spring-data-commons#3249, and spring-projects/spring-data-commons#1947.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.