Hibernate OGM 映射到子集合

Hibernate OGM mapping to subcollection

我有一个合集如下

application
 * _id
 * name
 * desc
 * settings
 ** _id
 ** magento
 *** name
 *** keys

我使用以下对象来映射文档

@Entity
@Table(name = "applications")
public class ApplicationEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Type(type = "objectid")
private String id;

@Column(name = "applicationName")
private String name;

@Column(name = "desc")
private String desc;

@Embedded
@Column(name = "settings.magento")
private MagentoSettings magentoSettings;

但是,无法映射对象 "MangetoSettings",它 return 为空。

我的问题是如何在不在对象中声明父文档(设置)的情况下映射子文档 (magento)?

假设 "Settings" 文档仅包含 "Magento",如果使用单个 属性.

声明 "Settings" 对象,它将被浪费

谢谢

我在 Jboss Hibernate 文档 here

中找到了答案

You can override the column name used for a property of an embedded object. But you need to know that the default column name is the concatenation of the embedding property, a . (dot) and the embedded property (recursively for several levels of embedded objects).

AttributeOverrides({
    @AttributeOverride(name="name", column=@Column(name="settings.magento.name")),
    @AttributeOverride(name="key", column=@Column(name="settings.magento.key"))
    })
private MagentoSettings magentoSettings;

谢谢