spring-projects / spring-data-rest

Simplifies building hypermedia-driven REST web services on top of Spring Data repositories
https://spring.io/projects/spring-data-rest
Apache License 2.0
905 stars 558 forks source link

Issue with Enum datatype in querydsl #2364

Closed prasannabalaraman closed 4 months ago

prasannabalaraman commented 4 months ago

I have an App entity class which has a enum field

@Enumerated(EnumType.STRING)
@Column(name = "platform", columnDefinition = "platform_enum")
private Platform platform;

My Platform enum is

public enum Platform { ANDROID, IOS; }

I have created enum in postgres too CREATE TYPE platform_enum AS ENUM ( 'IOS', 'ANDROID');

My repo class is

public interface AppRepository extends PagingAndSortingRepository<App, UUID>, QuerydslPredicateExecutor

When I try to {{baseUrl}}/{{apiVersion}}/{{apiContext}}/apps?platform=IOS, I am getting the following exception

Caused by: java.lang.IllegalArgumentException: Parameter value [IOS] did not match expected type [Platform (n/a)]

I tried converting the column type as varchar in DB but that doesnt help.

Appreciate your help.

mp911de commented 4 months ago

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal yet complete sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Please include the full stack trace.

spring-projects-issues commented 4 months ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues commented 4 months ago

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.