开发者

Morphia Generics - Not Possible?

开发者 https://www.devze.com 2023-04-05 17:20 出处:网络
I\'m trying to save a List of Generics(M) through Mongo/Morphia. I get this error when I tried to save:

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.


The error says everything:

com.google.code.morphia.mapping.MappingException: Generic Typed Class not supported: = class java.lang.Object

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;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号