您的位置:程序门 -> java -> j2ee / ejb / jms



hibernate的问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


hibernate的问题
发表于:2007-08-08 12:30:58 楼主
现在有3张表,student(id   ,name),course(id,name),score(引用student.id,引用course.id,score,examtime),2个实体类(student,course),其中student类中有(long   id;string   name;list <studentcoursepair>   pairs),一个组建类(studentcoursepair),组建类中引用了一个student类,引用了一个course类。在对应的student类的student.hbm.xml文件中
<class   name= "student "   table= "students ">
<id   name= "id "   column= "pkid "   type= "long ">
<generator   class= "identity "/>
</id>
<property   name= "name "   column= "[name] "   type= "string "/>
<bag   name= "pairs "   table= "student_course "   inverse= "true ">
<key   column= "fk_student "/>
<composite-element   class= "studentcoursepair ">
<parent   name= "student "/>
<many-to-one   name= "course "   column= "fk_course "   class= "course "/>
<property   name= "score "   column= "examscore "   type= "int "/>
<property   name= "time "   column= "examtime "   type= "date "/>
</composite-element>
</bag>
</class>

中间的 <many-to-one> 多方和一方分别是指哪个类?是不是pair   to   course?


快速检索

最新资讯
热门点击