学号200532580013
密级________________
武汉大学本科毕业论文
Hibernate持久化技术在网上购书系统中的设计与实现
院系名称国际软件学院
专业名称 软件工程
学生姓名 皮攀
指导教师
二○○九年六月
BACHELOR'S DEGREE THESISOF WUHAN UNIVER SITY
The design and implement ofHibernate persistence in the OnlineBookstore
College Wuhan University
Subject International Software
Engineering
Name PiPan
Directed by Professor
June 2009
郑重声明
本人呈交的学位论文是在导师的指导下独立进行研究工作所取得的成果所有数据、图片资料真实可靠。尽我所知除文中已经注明引用的内容外本学位论文的研究成果不包含他人享有著作权的内容。对本论文所涉及的研究工作做出贡献的其他个人和集体均已在文中以明确的方式标明。本学位论文的知识产权归属于培养单位。
本人签名 日期
摘 要
Hibernate是一个开放源代码的对象关系映射框架它对JDBC进行了非常轻量级的对象封装使得Java程序员可以随心所欲的使用对象编程思维来操纵数据库。Hibernate可以应用在任何使用JDBC的场合既可以在Java的客户端程序使用也可以在Servlet/JSP的Web应用中使用最具革命意义的是Hibernate可以在应用EJB的J 2EE架构中取代CMP完成数据持久化的重任。
本论文主要研究Hibernate的ORMObject Relationship Mapping 框架、持久 化 功 能 以 及 Hiberna te 中 的 六 个 核 心 接 口Session、SessionFactory、Transaction、Query、Criteria和Configuration 并对其进行相关实践。熟悉Hibernate中的框架结构、工作原理。结合Hibernate在网上购书网站上的实践体会和研究Hibernate的ORM框架和持久化。同时本论文也将说明利用Hiberna te的ORM框架和持久化功能来实现网上购书网站的业务层的基本功能。利用Hibernate的相关技术来对其功能进行优化达到高性能。关键词ORM持久化Hibernate的核心接口
ABSTRACT
Hibernate is a open source object-relation mapping framework, whoencapsulates JDBC in a l ight-weight-object way, and this makes Javaprogrammers operate database in the Object-Oriented way arbitrari ly.The Hibernate could user in the place where the JDBC could use, bothusing in the client, and in the the application of Servlet/JSP, themost revolutionary mean is that, the Hibernate could be used in theJ2EE with EJB instead of CMP, to accomplish the persistence.
The aim of this the paper is to study the ORM framework of theHibernate, persistence and the six core interfaces in the Hibernate:Session, SessionFactory, Transaction, Query Criteria andConfiguration, and implement them in the project . Understanding theframework of the Hibernate, the principle and the API of theHibernate. With the implement of the Hibernate in the OnlineBookstore, experience and study the framework and persistence of theHibernate. Achievement: With the Hibernate to implementing the basefunctions of the business level of the Online Bookstore. Use the othertechnologies of the Hibernate to optimize the functions, reachinghigher efficiency.
Keywords ORM Persistence Hibernate CoreInterface Session SessionFactory Transaction Query Criteria andConfiguration
目 录
第1章绪论. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
1 .1本章内容介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
1 .2研究背景. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
1 .3研究现状及发展趋势. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2
1 31研究现状 2
1 32发展趋势 3
1 .4项目研究的目的和意义. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
141研究目的 4
142研究意义 5
1 .5论文的主要内容. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
1 .6本章小结. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
第2章网上购书系统方案设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
1 .7本章内容介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
1 .8系统简单介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
1 81系统的定位以及系统开发软件 7
1 82系统的框架 . 7
1 .9系统总体方案设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
1 91用户模块设计 10
1 92管理员模块设计 13
1 93系统模块设计 17
1 .10本章小结. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
第3章Hibernate基本技术介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
1 .1 1本章内容介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
1 .12 Hibernate是什么. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
1 .13Hibernate的主要内容. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
1 131 Hibernate的框架 19
1 132Hibernate的工作原理 20
1 133Hibernate的核心接口 22
1 134Hibernate API中的主要部分 24
1 .14 Hibernate的优势和劣势. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
1 .15本章小结. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
第4章数据库设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
1 .16本章内容介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
1 .17数据库需求分析. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
1 .18数据库详细设计. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
1 .19本章小结. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
第5章系统实现与验证. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
1 .20本章内容介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
1 .21系统实现. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
1 21 1系统实现模块图 . 33
1 21 2基本类 34
v5net当前对香港和美国机房的走优质BGP+CN2网络的云服务器进行7折终身优惠促销,每个客户进线使用优惠码一次,额外有不限使用次数的终身9折优惠一枚!V5.NET Server提供的都是高端网络线路的机器,特别优化接驳全世界骨干网络,适合远程办公、跨境贸易、网站建设等用途。 官方网站:https://v5.net/cloud.html 7折优惠码:new,仅限新客户,每人仅限使用一次 9...
有在六月份的时候也有分享过新网域名注册商发布的域名促销活动(这里)。这不在九月份发布秋季域名促销活动,有提供年付16元的.COM域名,同时还有5个+的特殊后缀的域名是免费的。对于新网服务商是曾经非常老牌的域名注册商,早年也是有在他们家注册域名的。我们可以看到,如果有针对新用户的可以领到16元的.COM域名。包括还有首年免费的.XYZ、.SHOP、Space等等后缀的域名。除了.COM域名之外的其他...
tmhhost为2021年暑假开启了全场大促销,全部都是高端线路的VPS,速度快有保障。美国洛杉矶CN2 GIA+200G高防、洛杉矶三网CN2 GIA、洛杉矶CERA机房CN2 GIA,日本软银(100M带宽)、香港BGP直连200M带宽、香港三网CN2 GIA、韩国双向CN2。本次活动结束于8月31日。官方网站:https://www.tmhhost.com8折优惠码:TMH-SUMMER日本...