java注解JointTable如何给中间表指定主键
@ManyToMany(cascade=CascadeType.ALL)@JoinTable(name="RELA_PAGE_CHANNEL",joinColumns={...
@ManyToMany(cascade=CascadeType.ALL)
@JoinTable(name="RELA_PAGE_CHANNEL",
joinColumns={@JoinColumn(name="PAGE_ID")},
inverseJoinColumns={@JoinColumn(name="CHANNEL_ID")})
这是我写的多对多中间表注解 但是生成的表是联合主键 如何让中间表有单一的主键?并且中间表的新主键是新的一列? 展开
@JoinTable(name="RELA_PAGE_CHANNEL",
joinColumns={@JoinColumn(name="PAGE_ID")},
inverseJoinColumns={@JoinColumn(name="CHANNEL_ID")})
这是我写的多对多中间表注解 但是生成的表是联合主键 如何让中间表有单一的主键?并且中间表的新主键是新的一列? 展开
2个回答
展开全部
帅哥
@ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@JoinTable(name = "RELA_PAGE_CHANNEL",joinColumns = { @JoinColumn(name = "PAGE_ID", unique = false, referencedColumnName = "id") }, inverseJoinColumns = @JoinColumn(name = "CHANNEL_ID", unique = false, referencedColumnName = "id"))
这样玩的!
@ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@JoinTable(name = "RELA_PAGE_CHANNEL",joinColumns = { @JoinColumn(name = "PAGE_ID", unique = false, referencedColumnName = "id") }, inverseJoinColumns = @JoinColumn(name = "CHANNEL_ID", unique = false, referencedColumnName = "id"))
这样玩的!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询