为了账号安全,请及时绑定邮箱和手机立即绑定

如何在Hibernate 4和Spring中使用注释来定义不同类型的关系?

如何在Hibernate 4和Spring中使用注释来定义不同类型的关系?

青春有我 2019-07-27 09:59:14
如何在Hibernate 4和Spring中使用注释来定义不同类型的关系?我有两个班,Foo并且Bar,具体如下:public class Foo {      private Long fooId;      private Bar bar;      //Yes, this doesn't actually make any sense,      //having both a list and a single object here, its an example.      private List<Bar> bars;}public class Bar {     private Long barId;     private Foo foo;}如何使用Hibernate 4的注释为这些类实现(单向/双向)一对多,多对一或多对多关系?另外,我如何配置我的一对多的孤儿删除,延迟加载以及什么原因导致LazyInitialiaizationException处理集合以及如何解决问题?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 467 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信