学号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
每年的7月的最后一个周五是全球性质的“系统管理员日”,据说是为了感谢系统管理员的辛苦工作....friendhosting决定从现在开始一直到9月8日对其全球9个数据中心的VPS进行4.5折(优惠55%)大促销。所有VPS基于KVM虚拟,给100M带宽,不限制流量,允许自定义上传ISO...官方网站:https://friendhosting.net比特币、信用卡、PayPal、支付宝、微信、we...
这个月11号ShockHosting发了个新上日本东京机房的邮件,并且表示其他机房可以申请转移到日本,刚好赵容手里有个美国的也没数据就发工单申请新开了一个,这里做个简单的测试,方便大家参考。ShockHosting成立于2013年,目前提供的VPS主机可以选择11个数据中心,包括美国洛杉矶、芝加哥、达拉斯、杰克逊维尔、新泽西、澳大利亚、新加坡、日本、荷兰和英国等。官方网站:https://shoc...
spinservers是一家主营国外服务器租用和Hybrid Dedicated等产品的商家,Majestic Hosting Solutions LLC旗下站点,商家数据中心包括美国达拉斯和圣何塞机房,机器一般10Gbps端口带宽,且硬件配置较高。目前,主机商针对达拉斯机房机器提供优惠码,最低款Dual E5-2630L v2+64G+1.6TB SSD月付89美元起,支持PayPal、支付宝等...