如果有人知道如何做:我休眠OneToOne与特定条款
有一个实体
@Entity
public class AnEntity {
...
private String propertyA;
private String propertyB;
private String propertyC;
}
和字符串propertyA,propertyB和propertyC存储在不同的表有指向同AnEntity,名称和值字段,是这样的:
@Entity
public class Property {
...
private String name;
private String value;
}
我可以指定OneToOne加入在AnEntity与where子句中,我想有这样的:
@Entity
public class AnEntity {
...
@OneToOne(table = "properties")
@JoinColumn("anentity_id")
@WhereJoinTable(name = "propertyA")
private String propertyA;
...
}
任何帮助,非常感谢!谢谢!
的缺点这种方法是巢命名属性。比方说,你想直接在这个实体上公开'收费'地址和'邮寄'地址;你不能。他们会这样暴露:'properties.billing' – 2016-05-04 19:04:58