我正在为所有客户构建一个具有共同实体基础的 Web 应用程序
现在有些客户需要额外的字段,但我不想全部添加。我想过这样的事情:
@Embeddable
public class AdditionalDetails {
private String label;
private String text;
public AdditionalDetails() {}
// autogenerated getters and setters, hashCode(), equals()
}
@Entity
public class BusinessObject {
@Id
@Column(name = "string_id")
private long id;
@ElementCollection(fetch=FetchType.EAGER)
@MapKey(name = "language")
@CollectionTable(schema = "label", name = "multilingual_string_map",
joinColumns = @JoinColumn(name = "string_id"))
private Map<String, AdditionalDetails> map = new HashMap<String, AdditionalDetails>();
public BusinessObject() {}
// autogenerated getters and setters, hashCode(), equals()
}
不,问题是我将配置由 BusinessObject 添加到哪些属性?