【发布时间】:2014-02-05 18:34:15
【问题描述】:
在高层次上,我有一个“MainClass”类,它有一个“OtherEntity”列表。基本上有两个连接表。这两个连接表中有其他组件使用的元数据,但我没有定义实体,因为我们在连接操作之外不需要它们。但基本上 MainClass => TableOne => TableTwo => OtherEntity
我的实体定义
@Entity
public class MainClass {
// other stuff ...
// how to?
@OneToMany
private List<OtherEntity> otherEntities;
}
@Entity
public class OtherClass { // other stuff ... }
我的架构(旧版,无法修改)
table MainClass
PK id
...
table TableOne
PK id
FK main_class_id
FK table_two_id
table TableTwo
PK id
FK table_one_id
FK other_entity_id
table OtherEntity
PK id
...
如果可以的话,我想避免为 TableOne 和 TableTwo 创建实体。
【问题讨论】:
标签: java jpa eclipselink spring-data-jpa