摘要:
In many to many, it creates three tables in total.Student,Teacher,Student_teacherIn our example, all mappings are done in teacher class1.AnnotationTea... 阅读全文
posted @ 2015-10-24 09:07
fifi努刷题
阅读(161)
评论(0)
推荐(0)
摘要:
1.AnnotationGroup Class: we usually put @JoinColumn(name="xx") right below @OneToMany.However, since we will have @ManyToOne in user class, it auto ge... 阅读全文
posted @ 2015-10-24 08:48
fifi努刷题
阅读(632)
评论(0)
推荐(0)
摘要:
Group- User: one to manyIn group class, we have a Set users to store user;1.Annotation@Entity@Table(name="x_Group")public class Group { private int... 阅读全文
posted @ 2015-10-24 07:35
fifi努刷题
阅读(151)
评论(0)
推荐(0)
摘要:
Foreign key is always added on the "many" side;User-Group:Many-to-one1.AnnotationUser class: Just need to add @ManyToOne tag before group variableGrou... 阅读全文
posted @ 2015-10-24 07:19
fifi努刷题
阅读(151)
评论(0)
推荐(0)
摘要:
Wife is a component of Husband class and thus they are stored in one table in DB.1.AnnotationHusband: put @Embedded before component Wife.Only need on... 阅读全文
posted @ 2015-10-24 06:46
fifi努刷题
阅读(182)
评论(0)
推荐(0)
摘要:
1.AnnotationHusband class: @JoinColumns ({@JoinColumn(name="",referencedColumnName="") ,@JoinColumn(name="",referencedColumnName="")})@Entitypublic cl... 阅读全文
posted @ 2015-10-24 06:36
fifi努刷题
阅读(164)
评论(0)
推荐(0)
摘要:
Uni-direction: only one class has a referenceBidirection: both classes have the reference1.AnnotationUni-direction: no change to wife; wife_id is used... 阅读全文
posted @ 2015-10-24 06:02
fifi努刷题
阅读(224)
评论(0)
推荐(0)

浙公网安备 33010602011771号