本文介绍了Hibernate OGM中的继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Hibernate OGM中处理继承机制,尤其是使用MongoDB?在"Hibernate OGM Reference"中,我读到OGM不支持继承机制.那么有办法避免这个问题吗?谢谢

How you can handle the inheritance mechanism in Hibernate OGM, in particular using MongoDB? In "Hibernate OGM Reference" I read that the inheritance mechanism is not supported by OGM. So there is a way to avoid the problem? Thanks

推荐答案

该文档具有误导性,除javax.persistence.InheritanceType#JOINED外,还支持继承.

The documentation is misleading, inheritance is supported except for javax.persistence.InheritanceType#JOINED.

这意味着如果您的模型使用的是javax.persistence.InheritanceType#SINGLE_TABLEjavax.persistence.InheritanceType#TABLE_PER_CLASS.

This means that if your model is using javax.persistence.InheritanceType#SINGLE_TABLE or javax.persistence.InheritanceType#TABLE_PER_CLASS.

你应该没事的.

这篇关于Hibernate OGM中的继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 14:37