问题描述
我正在使用具有以下2个表的第三方数据库:
Instrument
------
id (pk int not null)
name
InstrumentGroup
------
groupName (pk varchar(25) not null)
instrumentId (pk fk int not null)
如何定义具有InstrumentGroup
集合的Group
(或定义Instrument
)实体?注意:该数据库没有Group
表`。我目前有:
@Entity
@Data
public class InstrumentGroup {
@EmbeddedId
private InstrumentGroupKey instrumentGroupKey;
}
@Embeddable
@Data
public class InstrumentGroupKey implements Serializable {
private String groupName;
@ManyToOne
@JoinColumn(name = "instrumentId")
private Instrument instrument;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)