- 浏览: 68046 次
- 性别:
文章分类
最新评论
husband表结构:
wife表结构:
wife表结构:
package com.bjsxt.hibernate; import java.io.Serializable; public class WifePK implements Serializable { private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
package com.bjsxt.hibernate; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; @Entity @IdClass(WifePK.class) public class Wife { private int id; private String name; private int age; public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Id public int getId() { return id; } public void setId(int id) { this.id = id; } @Id public String getName() { return name; } public void setName(String name) { this.name = name; } }
package com.bjsxt.hibernate; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.OneToOne; @Entity public class Husband { private int id; private String name; private Wife wife; @Id @GeneratedValue public int getId() { return id; } public String getName() { return name; } @OneToOne @JoinColumns( { @JoinColumn(name="wifeId", referencedColumnName="id"), @JoinColumn(name="wifeName", referencedColumnName="name") } ) public Wife getWife() { return wife; } public void setId(int id) { this.id = id; } public void setName(String name) { this.name = name; } public void setWife(Wife wife) { this.wife = wife; } }
发表评论
-
22.hibernate继承映射joined
2011-12-07 18:14 760person表结构: teacher表结构: studen ... -
21.hibernate继承映射table_per_class
2011-12-07 18:14 999t_gen_table表结构: person表结构: te ... -
20.hibernate继承映射single_table
2011-11-25 12:17 833单个表: person表结构如下: package co ... -
19.hibernate多对多双向关联
2011-11-25 12:17 730package com.bjsxt.hibernate; ... -
18.hibernate多对多单向关联
2011-11-25 12:17 720package com.bjsxt.hibernate; ... -
17.hibernate一对多,多对一双向关联
2011-11-25 12:17 912package com.bjsxt.hibernate; ... -
16.hibernate一对多单向关联
2011-11-25 12:16 726package com.bjsxt.hibernate; ... -
15.hibernate多对一单向关联
2011-11-24 00:48 800package com.bjsxt.hibernate; ... -
14.hibernate 一对一component(组合),jpa映射
2011-11-24 00:48 1093只存在一个表: husband表结构: package ... -
12.hibernate一对一双向主键关联,jpa映射
2011-11-24 00:47 995husband表结构: wife表结构: pack ... -
11.hibernate一对一双向主键关联,xml映射
2011-11-24 00:46 783student表结构: stuidcard表结构 ... -
10.hibernate一对一单向主键关联,jpa映射
2011-11-23 19:43 1461husband表结构: wife表结构: pac ... -
9.hibernate一对一单向主键关联,xml映射
2011-11-23 19:42 925student表结构: stuidcard表结构 pa ... -
8.hibernate一对一双向外键关联,jpa映射
2011-11-23 19:42 868husband表结构: wife表结构 packa ... -
7.hibernate一对一双向外键关联,xml映射
2011-11-23 19:41 875stuidcard表结构: student表结构: ... -
6.hibernate一对一单向外键关联,jpa映射
2011-11-23 19:40 1673husband表结构: wife表结构 package ... -
5.hibernate一对一单向外键关联,xml映射
2011-11-21 18:25 430stuidcard表结构: student表结构: p ... -
4.hibernate联合主键,jpa映射
2011-11-21 18:17 934package com.bjsxt.hibernate; ... -
3.hibernate联合主键,xml映射
2011-11-21 18:13 966package com.bjsxt.hibernate; ... -
2.hibernate 枚举类型, 布尔类型,不持久化属性映射
2011-11-21 18:06 1388package com.bjsxt.hibernate; ...
相关推荐
Hibernate 一对一唯一外键关联映射详解 Hibernate是一种流行的Java持久层框架,提供了多种关联映射方式,其中一对一唯一外键关联映射是一种常见的关联方式。在本文中,我们将详细介绍Hibernate一对一唯一外键关联...
Hibernate 一对一主键单向关联 Hibernate 一对一连接表单向关联 Hibernate 一对多外键单向关联 Hibernate 一对多连接表单向关联 Hibernate 多对一外键单向关联 Hibernate 多对一连接表单向关联 Hibernate 多对多单向...
NULL 博文链接:https://12345678.iteye.com/blog/723871
NULL 博文链接:https://cdxs2.iteye.com/blog/1932507
博文链接:https://shaqiang32.iteye.com/blog/201311
博文链接:https://shaqiang32.iteye.com/blog/201312
NULL 博文链接:https://zhouhaitao.iteye.com/blog/1171227
Hibernate 一对多 外键 单向关联,有例子。
│ ├─ 一对一主键单向关联 │ ├─ 一对一连接表单向关联 │ ├─ 一对多外键单向关联 │ ├─ 一对多连接表单向关联 │ ├─ 多对一外键单向关联 │ ├─ 多对一连接表单向关联 │ └─ 多对多单向关联 └─双向...
hibernate外键实现一对一单向关联关系源码
NULL 博文链接:https://ganshisheng.iteye.com/blog/434420
NULL 博文链接:https://huihai.iteye.com/blog/1243558
NULL 博文链接:https://huihai.iteye.com/blog/1243530
http://blog.csdn.net/e421083458/article/details/8794127 该源码为Hibernate教程配套源码
博文链接:https://llying.iteye.com/blog/220804
Hibernate一对一外键映射实例,里面包含源程序,测试程序,映射文档
hibernate一对一外键关系,很适合入门者学习.
个人的很详细的Hibernate一对一映射配置详解,对初学者有帮助!