Many to One 怎么样配置组合主键后自动生成了前缀,在hql查询中还使用了LEFT JOIN,在线等,全分送

Many to One 怎么样配置组合主键后自动生成了前缀,在hql查询中还使用了LEFT JOIN,在线等,全分送,第1张

映射关系中,不需要按SQL那样写JOIN的。

SELECT per.* FROM Personne per WHERE per.site.xxx=?

关系的中间表,不需要建立entity。直接在ManyToOne和OneToMany中设置

你的KeyValuePK里面的内容,直接添加就可以!

public class BillTbodyPK implements Serializable {

private static final long serialVersionUID = -1190986010439330142L

private SingleInfo mid

private BillHeadModel billId

public BillTbodyPK() {

}

// setter getter

@ManyToOne(fetch = FetchType.LAZY,cascade = { CascadeType.ALL })

@JoinColumn(name = "mid", referencedColumnName = "mid", unique = false, nullable = false, insertable = false, updatable = false)

@NotFound(action = NotFoundAction.IGNORE)

@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)

public SingleInfo getMid() {

return mid

}

public void setMid(SingleInfo mid) {

this.mid = mid

}

@ManyToOne

@JoinColumn(name = "dj_id", nullable = false)

@NotFound(action = NotFoundAction.IGNORE)

@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)

public BillHeadModel getBillId() {

return billId

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11395289.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存