Redis(grails 插件)不持久化 Enum 对象
我有一个 grails 域类,我必须在 Redis 中持久化,如下所示:
class A {
String one
Integer two
B three
E four
mapWith = "redis"
}
class B {
String name
}
enum E {
VALUE1, VALUE2
}
当我使用 GORM .save() 方法持久化类 A 的实例时,Redis 会正确保存它,除了枚举字段“四”之外。
正如您所看到的,这一事实已被了解并报告如下: http://jira.grails.org/browse /GPREDIS-3
是否有一个好的解决方法来保存 Enum 或类似的东西? 我们正在考虑 String 对象数组,你觉得怎么样?
I've got a grails domain class I have to persist in Redis, something like this:
class A {
String one
Integer two
B three
E four
mapWith = "redis"
}
class B {
String name
}
enum E {
VALUE1, VALUE2
}
When I persist an instance of class A with the GORM .save() method, Redis saves it correctly except for the enum field "four".
As you can see the fact is known and reported here: http://jira.grails.org/browse/GPREDIS-3
Is there a good workaround to save Enum or something similar?
We're thinking about an array of String objects, what do you think?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经基本实现了这个功能,但它不适用于 Gemfire,我正在等待所有受支持的 nosql 提供程序修复它,然后再推送修复。作为解决方法,您可以将
inList
约束与持久String
属性和非持久 get/set 对以及当前属性的名称结合使用,例如I've got this mostly implemented but it doesn't work for Gemfire and I'm waiting until it's fixed for all the supported nosql providers before pushing the fix. As a workaround you can use the
inList
constraint with a combination of a persistentString
property and a non-persistent get/set pair with the name of your current property, e.g.