spring-projects / spring-projects/spring-data-commons

Query exposed through Spring-Data-Rest will throw an exception if configured a filter on a List of enums

Open
#3,502 1 comment 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Jun 29, 2026.

type: bug
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

The following line of class ReflectionRepositoryInvoker
result[i] = targetType.isInstance(value) ? value : convert(value, param);
In case of targetType List doesn't verify if the generic element required is an enum or a String, skipping the conversion into List of enum.
Hibernate will throw an exception if we provide at least 2 elements.
The convert method, skipped due to the true condition, would have handled the conversion avoiding the error

https://github.com/spring-projects/spring-data-commons/blob/0d3cf4ab81a071551631461a7933bd501f14d23a/src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java#L191

I reproduced the error on the following repository:
https://github.com/antonioT90/spring-data-rest-enums-errors-sample

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.