当 String 不是映射实体的键时,您能否帮助持久化 Map?例如:
class A {
@Id
long id;
String code;
}
class B {
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@What magical combination of JPA annotations should I use here?!
Map<String,A> mapAByCode;
}
我尝试了很多 {@JoinTable,@MapKeyColumn,@JoinColumn,@JoinTable} 注释的组合都没有成功,我快疯了......
谢谢!