【发布时间】:2011-12-25 12:15:24
【问题描述】:
我在可能的最简单化身中使用 Mongo(结合 Spring Data)。
我有两个(第一类)实体 (@Documents) A 和 B,其中 A 在其中包含 B 的引用 (@DBRef)。创建 A 和 B 时一切正常。但是,当读取对象 A(按 Id)时,引用 B 始终为 null。
我相信默认情况下会急切地获取 DBRefs(请参阅http://static.springsource.org/spring-data/data-document/docs/current/reference/html/#mapping-usage-references),但目前的行为与此相反。任何想法为什么?
【问题讨论】:
-
我对 RC1 也有同样的问题。通过外壳,我看到了正确的 dbref ,但是加载时引用始终为空。你升级了库吗?
标签: java spring mongodb spring-data spring-data-document