Skip to content

Spring boot works incorrectly with nativeQuery with enum param with H2 and mariadb #3251

Closed as not planned
@sergeybaltak

Description

@sergeybaltak

I have an entity with enum field. When I use native query with param of enum type and @Enumerated(EnumType.STRING) annotation it works incorrectly. I use spring-boot-starter-parent 3.4.2. I try to write the native sql query with parameter of enum type. And repository doesn't recognise it correctly. It works fine when I use spring data like findByStatus but it doesn't work for native queries. It gets entites with incorrect status. If you reorder enum values you will get another results. When I don't use @Enumerated(EnumType.STRING) annotation it works correctly.

https://stackoverflow.com/questions/79449411/spring-boot-works-incorrectly-with-nativequery-with-enum-param-with-h2-and-maria

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions