数据表-java类的映射

1.一个数据表对应一个java类

2.数据表的字段对应java类的属性

3.一对多的数据表关系

   一方用一个java对象表示

   多方用一个java对象数组表示

4.多对多的数据表关系:采用中间表,将多对多转为多对一进行处理

   eg:
        Student类:每个学生有多门课程(多个学生_课程表)
        Course类:每门课程有多个学生(多个学生_课程表)
        Student_Course类:(中间表)
          private  Student student;
          private  Course course;
          

 

 

posted @ 2017-08-30 21:58  scwyfy  阅读(282)  评论(0编辑  收藏  举报