首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

OneToMany 当中表关联

2012-09-06 
OneToMany 中间表关联Class@Testpublic void testOneToManyJoinTable() {session.beginTransaction()OneT

OneToMany 中间表关联

Class

@Testpublic void testOneToManyJoinTable() {session.beginTransaction();OneToMany.joinTable.Class c = new OneToMany.joinTable.Class();c.setClassName("classNmae");OneToMany.joinTable.Student s1 = new OneToMany.joinTable.Student();OneToMany.joinTable.Student s2 = new OneToMany.joinTable.Student();OneToMany.joinTable.Student s3 = new OneToMany.joinTable.Student();s1.setStudentName("s1");s2.setStudentName("s1");s3.setStudentName("s1");c.getStudents().add(s3);c.getStudents().add(s2);c.getStudents().add(s1);s3.setMyclass(c);s2.setMyclass(c);s1.setMyclass(c);session.save(c);session.getTransaction().commit();}

?

热点排行