Morphia 仿制药 - 不可能吗?
我正在尝试通过 Mongo/Morphia 保存泛型列表(M)。当我尝试保存时出现此错误:
com.google.code.morphia.mapping.MappingException: Generic Typed Class not support: = class java.lang.Object
这是否意味着 Morphia 根本不支持泛型?有没有可行的替代方案?使用泛型为我节省了 16 个类。必须有一种更简单的方法被允许。
令人惊讶的是,我找不到任何关于此错误的有用信息。
I'm trying to save a List of Generics(M) through Mongo/Morphia. I get this error when I tried to save:
com.google.code.morphia.mapping.MappingException: Generic Typed Class not supported: = class java.lang.Object
Does this mean that Morphia doesn't support Generics at all? Is there an alternative that would work? Using generics saves me 16 classes. There has to be an easier way that is allowed.
Surprisingly I haven't been able to find anything useful on this error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误说明了一切:
Morphia 不支持在数据库中保存泛型,因此,您可以尝试创建一个简单的接口,然后让所有要保存的类实现它,或者类似的东西。
希望有帮助;
The error says everything:
Morphia does not support save generics in the DB, so, you can try to make a simple interface and then make all classes you want to save implement it, or something like that.
hope it helps;