You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a query in my repository to find entities by a few properties and one of these properties is an enum.
Since Spring Data JDBC doesn't support derived queries yet, I'm creating a method with Query annotation in my entity repository.
In prodution we use PostgreSQL but ind development we use H2.
My method with query annotation is someting like:
@Query("SELECT t.* FROM ENTITY t WHERE t.date1= :date1 AND t.date2= :date2 AND t.entity_type = :entityType")
List<MyEntity> findByDate1AndDate2AndEntityType(@Param("date1") LocalDatedate1, @Param("date2") LocalDatedate2, @Param("entityType") EntityTypeentityType)
The FI is my enum value used in the search.
If I change my repository method to use String instead of EntityType enum and call it with the enum name it works fine and I receive a list of MyEntity with the property entityType with the right value.
Due to coherence I would like to keep using EntityType. Changing this method to use String would allow it to be called with any value that are not valid enum values which results in an empty list.
When derived queries support is released the idea is to remove this Query annotation
Issue Links:
DATAJDBC-412 Custom value type can't be used as Id
The text was updated successfully, but these errors were encountered:
A new test on main to reproduce this issue already passes. The same test applied before the commits to resolve DATAJDBC-464 fails with the exception org.h2.jdbc.JdbcSQLDataException: Hexadecimal string with odd number of characters: "FIRST"; and passes when applied after these commits.
Fábio Coutinho Valente opened DATAJDBC-409 and commented
I'm trying to create a query in my repository to find entities by a few properties and one of these properties is an enum.
Since Spring Data JDBC doesn't support derived queries yet, I'm creating a method with Query annotation in my entity repository.
In prodution we use PostgreSQL but ind development we use H2.
My method with query annotation is someting like:
When I call this method I get an exception like
The FI is my enum value used in the search.
If I change my repository method to use String instead of EntityType enum and call it with the enum name it works fine and I receive a list of MyEntity with the property entityType with the right value.
Due to coherence I would like to keep using EntityType. Changing this method to use String would allow it to be called with any value that are not valid enum values which results in an empty list.
When derived queries support is released the idea is to remove this Query annotation
Issue Links:
The text was updated successfully, but these errors were encountered: