Spring data 按枚举类型的spring R2DBC查询

Spring data 按枚举类型的spring R2DBC查询,spring-data,spring-data-r2dbc,r2dbc-postgresql,Spring Data,Spring Data R2dbc,R2dbc Postgresql,我的PostgreSQL包含一个类似 create type my_type as enum('VAL1', 'VAL2') 在Spring boot应用程序中,它由MyType.class enum 我正在尝试使用databaseclient client.exectute("select * from table where type = :type")... 作为一个错误,我得到: ceptionFactory$PostgresqlBadGrammarException: operat

我的PostgreSQL包含一个类似

create type my_type as enum('VAL1', 'VAL2')
在Spring boot应用程序中,它由
MyType.class enum

我正在尝试使用
databaseclient

client.exectute("select * from table where type = :type")...
作为一个错误,我得到:

ceptionFactory$PostgresqlBadGrammarException: operator does not exist: type = character varying
将类型转换为
my_type
不起作用(与CAST和:)


我已经为
MyType.class
注册了一个特定的编解码器,该编解码器可以工作-使用相关的
@ReadingConverter

Spring数据R2DBC和R2DBC Postgres都不能将您的枚举类型映射到Postgres枚举类型

如果在SQL语句中正确地强制转换检索时的绑定值/列值,则仍然可以使用表示为字符串的Postgres枚举类型

例如:

client.exectute("select type::text from table where type = :type::my_type")

我不确定我是否理解您的答案-r2dbc可以(而且是)使用自定义编解码器映射我的枚举。铸造也不起作用。如果你有答案,添加一个代码示例将非常好。如果你可以添加一个铸造示例将非常好。我尝试了所有我知道的铸造方法,但仍然得到了角色的不同。谢谢,很高兴我的问题(也许?)导致了公关