标签:主键 col public com data bsp 接口 实现 zab
使用@Embeddable注解,组合键的类必须实现 Serializable 接口
@Data @Embeddable public class UserCommentId implements Serializable { @OneToOne @JoinColumn(name = "user_id") private User user; @OneToOne @JoinColumn(name = "comment_id") private Comment comment; }
使用:
@Data @Entity public class UserComment { @EmbeddedId private UserCommentId userCommentId; }
标签:主键 col public com data bsp 接口 实现 zab
原文地址:https://www.cnblogs.com/cearnach/p/9255429.html