07 2011 档案

摘要:又从头学习了一遍hibernate的映射关系,每一次都会有新的收获,总是感觉自己还是不会hibernate。单从配置上说:知其然不知其所以然,马上就要找工作的人了,很是为自己担心呀!!众所周知,hibernate是一个杰出的O/RMapping(Object-RelationlMapping)框架,单从英文字面意思来解释:对象关系映射。在面向对象编程的过程中,我们往往先抽象出系统中涉及的实体对象,然后根据对象建立数据表,无疑后面对于数据库的操作是面向过程的。面向对象是简洁的,面向过程(操作数据库,写sql语句)是复杂的。Hibernate恰恰屏蔽了数据库操作这层,用户只需用面向对象的直观意.. 阅读全文
posted @ 2011-07-23 19:20 focusJ 阅读(1643) 评论(0) 推荐(0)
摘要:实体:package bi.many2many.jointable;import java.util.HashSet;import java.util.Set;public class Student { private int id; private String name; private Set<Teacher> teachers = new HashSet<Teacher>(); public Student() { } public Student(int id, String name, Set<Teacher> teachers) { supe 阅读全文
posted @ 2011-07-23 10:50 focusJ 阅读(466) 评论(0) 推荐(0)
摘要:实体:package bi.one2one.jointable;public class Husband { private int id; private String name; private Wife wife; public Husband() { } public Husband(int id, String name, Wife wife) { super(); this.id = id; this.name = name; this.wife = wife; } public int getId() { return id; } public void setId(i... 阅读全文
posted @ 2011-07-23 10:46 focusJ 阅读(336) 评论(0) 推荐(0)
摘要:实体:package bi.one2many.jointable;import java.util.HashSet;import java.util.Set;public class Emperor { private int id; private String name; private Set<Minister> ministers = new HashSet<Minister>(); public Emperor() { } public Emperor(int id, String name, Set<Minister> ministers) { 阅读全文
posted @ 2011-07-23 10:42 focusJ 阅读(462) 评论(1) 推荐(0)
摘要:实体:package bi.one2one;public class Husband { private int id; private String name; private Wife wife; public Husband() { } public Husband(int id, String name, Wife wife) { super(); this.id = id; this.name = name; this.wife = wife; } public int getId() { return id; } public void setId(int id) { ... 阅读全文
posted @ 2011-07-23 10:36 focusJ 阅读(416) 评论(0) 推荐(0)
摘要:实体:package bi.one2many;import java.util.HashSet;import java.util.Set;public class Emperor { private int id; private String name; private Set<Minister> ministers = new HashSet<Minister>(); public Emperor() { } public Emperor(int id, String name, Set<Minister> ministers) { super(); t 阅读全文
posted @ 2011-07-23 10:34 focusJ 阅读(541) 评论(0) 推荐(0)
摘要:实体:package uni.many2many.jointable;import java.util.HashSet;import java.util.Set;public class Student { private int id; private String name; private Set<Teacher> teachers = new HashSet<Teacher>(); public Student() { } public Student(int id, String name, Set<Teacher> teachers) { sup 阅读全文
posted @ 2011-07-23 10:22 focusJ 阅读(263) 评论(0) 推荐(0)
摘要:实体:package uni.one2one.jointable;public class Husband { private int id; private String name; private Wife wife; public Husband() { } public Husband(int id, String name, Wife wife) { super(); this.id = id; this.name = name; this.wife = wife; } public int getId() { return id; } public void setId(... 阅读全文
posted @ 2011-07-23 10:19 focusJ 阅读(196) 评论(0) 推荐(0)
摘要:实体:package uni.many2one.jointable;public class Parent { private int id; private String name; private Child child; public Parent() { } public Parent(int id, String name, Child child) { super(); this.id = id; this.name = name; this.child = child; } public int getId() { return id; } public void se... 阅读全文
posted @ 2011-07-23 10:17 focusJ 阅读(250) 评论(0) 推荐(0)
摘要:实体:package uni.one2many.jointable;import java.util.HashSet;import java.util.Set;public class Emperor { private int id; private String name; private Set<Minister> ministers = new HashSet<Minister>(); public Emperor() { } public Emperor(int id, String name, Set<Minister> ministers) { 阅读全文
posted @ 2011-07-23 10:16 focusJ 阅读(235) 评论(0) 推荐(0)
摘要:这里举了皇帝和大臣的例子,天子只有一个,而诸侯多的不胜计数。实体:package uni.one2many;import java.util.HashSet;import java.util.Set;public class Emperor { private int id; private String name; private Set<Minister> ministers = new HashSet<Minister>(); public Emperor() { } public Emperor(int id, String name, Set<Minis 阅读全文
posted @ 2011-07-23 10:13 focusJ 阅读(429) 评论(0) 推荐(0)
摘要:这里举了一夫一妻的例子。实体:package uni.one2one;public class Husband { private int id; private String name; private Wife wife; public Husband() { } public Husband(int id, String name, Wife wife) { super(); this.id = id; this.name = name; this.wife = wife; } public int getId() { return id; } public void se... 阅读全文
posted @ 2011-07-23 10:08 focusJ 阅读(459) 评论(0) 推荐(0)
摘要:在这里举了一个不太恰当的例子:双亲和孩子。当然举这个例子也有一定的道理,一个孩子至少有两个parent,但是例子只是例子,重点不是例子而是配置方法。下面我们看一下配置的详细步骤:实体:package uni.many2one;public class Child { private int id; private String name; public Child(int id, String name) { super(); this.id = id; this.name = name; } public Child() { } public int getId() { retur... 阅读全文
posted @ 2011-07-23 10:05 focusJ 阅读(485) 评论(0) 推荐(0)