Spring Data MongoDB 是否支持枚举? [英] Does Spring Data MongoDB support enums?
本文介绍了Spring Data MongoDB 是否支持枚举?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于Java枚举类型,我了解到MongoDB有两种解决方案:序列化 和使用 Jackson 的 ObjectMapper.MongoRepository 是否可以使用这些方法中的任何一种来处理枚举数据类型,或者我必须编写自定义存储库?
For Java enum type, I learn that there are two solutions for MongoDB: serialization and using Jackson’s ObjectMapper. Can the MongoRepository work with an enum data type with either of those approaches or I have to write a customized repository?
推荐答案
是的,Spring Data MongoDB 支持枚举.只需在您的域模型中使用它们即可.
Yes, Spring Data MongoDB supports enums. Just use them in your domain model.
这篇关于Spring Data MongoDB 是否支持枚举?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文