欢迎来到天天文库
浏览记录
ID:35342317
大小:78.54 KB
页数:7页
时间:2019-03-23
《实验三hibernate关联映射和hql语句》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实验三Hibernate关联映射和HQL语句班级:计算机23J学号:13034480149姓名:刘炳君成绩:—、实验目的(1)掌握Hibernate的关联映射,重点拿握一对多关联和多对一映射,能编写程序(实体类、映射文件、测试类)实现-•対多和多对一映射。(2)掌握HQL语句的基本用法。二、实验内容(1)完成课本P135实验六。口da@pg(localhost_3306)-表■・••cla@prj(localhost_3306...X亡student@prj(localhost_...X文件務查看GE語助C3导入向号CS辱
2、岀问导了诗选冋导网"*二铮注idcname口student@prj(localhost_3306)-Bda@prj(localhost_3306...XLstudent@prj(localhosL,..X文件漏辐查看窗口Sfc©导入向导Q导岀向导篇选向导H网格童看表单童看备注idsnamecid□da@prj(localhost_3306)■表(5student@prj(localhost^...Xcla@prj(localhost_3306...X文件漏辑壹看窗口稲型13号入向导E3导迄向导帝;8送向导
3、旺HffOES二
4、UK*•■注idcname►10钦件10111钦件102student@prj(iocaino5t_55uo)-衣CStudent@prj(localhost_...x亡cia@prj(localhost_3306...x文件礎莹看SC番助导入向导13导岀冋导了抹选问导网略査看同丧单查看L:备注idsnamecid►13却1014郴中1015孙权1116周瑜11••Hibernat巳DynamicQueryTranslator旦Console空Test2(1)[JavaApplication]D:
5、ProgramAlesMyEclipseCommonbinary2016-5-3015:09:48org.hibernate>inipl.SessionFactoryObjectFactoryaddlnst:Notbindingfactoryto3NDIjnoJKOInameconfigured李:e⑵完成课木P147实验七。HQL查询HibernateDynamicQueryTranslator回1.ConsoleTesti(3)[JavaApplication]D:ProgramFil
6、esMyEclipseCommonbinary'roi:buildingsessionfactory2016-5-3120:45:03org.hibernate7、・ge£Session();Queryquery=session.createQueryC'fromDepartmentwheredepNamelike行政072%'”);Listusers=query.list();Iteratorit=users.iterator();while(it.hasNext()){Departmentd=(Depar•next();System.out.printIn(d•getDepld());}session.close();2.精确查询HibernateOynamicQueryTran8、slator@ConsoleS3一一一F一Testi(3)[JavaApplication]D:ProgramniesMyEclipseCommonbinarycom.suiftt:buildingsessionfactory2016-5-312G:51:46org•hibernate.impl.SessionFactoryObjectFactoryaddlnstance•?*:Notbindingfactoryto3^01,no3NDInameconfigured女52模糊查询Hiber9、nateDynamicQueryTranslatorOConsoleTest2(2)[JavaApplication]D:ProgramFilesMyEclipseCommonbinarycom.sun.j<2016-5-3121:16:43org.hibernate•
7、・ge£Session();Queryquery=session.createQueryC'fromDepartmentwheredepNamelike行政072%'”);Listusers=query.list();Iteratorit=users.iterator();while(it.hasNext()){Departmentd=(Depar•next();System.out.printIn(d•getDepld());}session.close();2.精确查询HibernateOynamicQueryTran
8、slator@ConsoleS3一一一F一Testi(3)[JavaApplication]D:ProgramniesMyEclipseCommonbinarycom.suiftt:buildingsessionfactory2016-5-312G:51:46org•hibernate.impl.SessionFactoryObjectFactoryaddlnstance•?*:Notbindingfactoryto3^01,no3NDInameconfigured女52模糊查询Hiber
9、nateDynamicQueryTranslatorOConsoleTest2(2)[JavaApplication]D:ProgramFilesMyEclipseCommonbinarycom.sun.j<2016-5-3121:16:43org.hibernate•
此文档下载收益归作者所有