Hibernate one to zero or one mapping

I'm trying to map a one to "zero or one" relationship in Hibernate. I think I may have found a way using a many-to-one. class A { private B b; // ... getters and setters } class B { private A a; } Class A's mapping specifies: and Class B's mapping specifies: What I would like is for b to be null when no matching row for B was found in the database. So I can do this (in class A): if (b == null) However, it seems that b is never null. What can I do about this?

以上就是Hibernate one to zero or one mapping的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准