對於在我們的項目的要求之一,我們以下幾點:JPA + Hibernate映射爲擴展表
http://msdn.microsoft.com/en-us/library/aa479086.aspx#mlttntda_nvp來管理多個租戶。
請參考上面的表格結構圖的鏈接。
我需要幫助來管理映射。這是我在想什麼:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class AbstractEntity {
@Id @GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
@OneToMany(mappedBy="entities")
private Set<ExtensionTable> extensionTable = new HashSet<ExtensionTable>();
....
}
@Entity
public class ExtensionTable {
@Id @GeneratedValue
private Long id;
@ManyToOne
private Set<AbstractEntity> entities = new HashSet<AbstractEntity>();
...
}
@Entity
public class Employee extends AbstractEntity {
...
}
我發現很難定義元數據表的映射。