如果有人知道如何做:我休眠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