如何定义两个可嵌入类之间的映射?

时间:2019-01-04 21:43:21

标签: java database hibernate jpa

假设我有两个带有可嵌入/复合键的实体类... 例如

@Entity 
public class X
{
     @EmbeddedId private Embed id;
     ......

@Embeddable public class Embed
{
    private int a;
    private int b;
   .......

@Entity 
public class Y
{
     @EmbeddedId private YEmbed id;
     ......

@Embeddable public class YEmbed
{
    private int a1;
    private int b1;
   .......

现在在上述情况下,我想定义某种映射,例如使用组合键字段a与a1或b与b1与OnetoOne或ManytoOne或表X和Y之间的任何其他映射???

如何在spring-jpa / hibernate中实现这一目标?

提前谢谢。...

0 个答案:

没有答案