设为首页 加入收藏

TOP

介绍一下hibernate中实体类之间的关联和映射
2014-11-22 12:40:03 来源: 作者: 【 】 浏览:16
Tags:介绍 hibernate 实体 之间 联和 映射

Many to one:
通过many-to-one元素,可以定义一种常见的与另一个持久化类的关联.这种关系模型是多对一关联:这个表的一个外键引用目标表的主键字段.
One to one
主键关联


Two tables related by a primary key association share the same primary key values. The primary key of one table is also a foreign key of the other.
唯一外键关联(单项双向)
单向:
双向:
1.在employee中加一个外键,
2.然后在person配置中加入
property-ref=“person的emplyee属性"/>
One to many:
unidirectional
Bidirectional
many to many:
many-to-many association has its own table, the link table or association table.
单向
双向


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇各公司Java面试题汇总 下一篇西安华讯科技面试题 Linux

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: