接着上一篇博客写,记:数据库课程设计(一);
首先又对上一次的数据库结构和字段类型进行了微调:
下面介绍一下真个开发框架和我设想的基本步骤:
开发框架:利用javaEE(javaEE5)进行开发,使用Spring 框架和 Hibernate持久层框架(其中可能还是会写一些sql语句,毕竟是数据库课设嘛)
数据库选择:SQL Sever 2005
开发工具(软件):SybasePowerDesigner,SQL Server Management Studio 2008,MyEclipse 9
所用知识:Java基础,JavaEE知识,hibernate知识,数据库知识,javascript,jquery,css3,html5(前端开发打算尝试使用html5)
步骤:
1.数据库设计(已完成)
2.建立java web工程,利用hibernate反向工程生成相应的model,导入需要的lib,设计最初的包结构(model,controller,imp)和目录结构(page,css,js,imagine)
3.初步设计完成课设要求的html功能页面
4.编写jsp和后台java代码(sql语句)
5.修改调试
(6.找老师检查)
刚刚完成功了第二步,详细信息如下:
<1>.工程结构(如图):
<2>.利用powerdesigner生成sql文件:
/*==============================================================*/
/* DBMS name: Microsoft SQL Server 2005 */
/* Created on: 2011/12/18 11:21:08 上午 */
/*==============================================================*/
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_apartmentmanager') and o.name = 'FK_TB_APART_REFERENCE_TB_MANAG')
alter table tb_apartmentmanager
drop constraint FK_TB_APART_REFERENCE_TB_MANAG
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_apartmentmanager') and o.name = 'FK_TB_APART_REFERENCE_TB_APART')
alter table tb_apartmentmanager
drop constraint FK_TB_APART_REFERENCE_TB_APART
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_chargerecord') and o.name = 'FK_TB_CHARG_REFERENCE_TB_ROOM')
alter table tb_chargerecord
drop constraint FK_TB_CHARG_REFERENCE_TB_ROOM
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_chargerecord') and o.name = 'FK_TB_CHARG_REFERENCE_TB_MANAG')
alter table tb_chargerecord
drop constraint FK_TB_CHARG_REFERENCE_TB_MANAG
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_room') and o.name = 'FK_TB_ROOM_REFERENCE_TB_APART')
alter table tb_room
drop constraint FK_TB_ROOM_REFERENCE_TB_APART
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_student') and o.name = 'FK_TB_STUDE_REFERENCE_TB_ROOM')
alter table tb_student
drop constraint FK_TB_STUDE_REFERENCE_TB_ROOM
go
if exists (select 1
from sysobjects
where id = object_id('tb_apartment')
and type = 'U')
drop table tb_apartment
go
if exists (select 1
from sysobjects
where id = object_id('tb_apartmentmanager')
and type = 'U')
drop table tb_apartmentmanager
go
if exists (select 1
from sysobjects
where id = object_id('tb_chargerecord')
and type = 'U')
drop table tb_chargerecord
go
if exists (select 1
from sysobjects
where id = object_id('tb_manager')
and type = 'U')
drop table tb_manager
go
if exists (select 1
from sysobjects
where id = object_id('tb_room')
and type = 'U')
drop table tb_room
go
if exists (select 1
from sysobjects
where id = object_id('tb_student')
and type = 'U')
drop table tb_student
go
/*==============================================================*/
/* Table: tb_apartment */
/*==============================================================*/
create table tb_apartment (
apartmentID numeric identity,
apartmentNO nvarchar(30) null,
floorNums int null,
roomNums int null,
startTime datetime null,
constraint PK_TB_APARTMENT primary key (apartmentID)
)
go
/*==============================================================*/
/* Table: tb_apartmentmanager */
/*==============================================================*/
create table tb_apartmentmanager (
id numeric identity,
apartmentID numeric null,
managerID numeric null,
constraint PK_TB_APARTMENTMANAGER primary key (id)
)
go
/*==============================================================*/
/* Table: tb_chargerecord */
/*==============================================================*/
create table tb_chargerecord (
recordID int not null,
roomID int null,
managerID numeric null,
time datetime null,
type nvarchar(30) null,
money int null,
constraint PK_TB_CHARGERECORD primary key (recordID)
)
go
/*==============================================================*/
/* Table: tb_manager */
/*==============================================================*/
create table tb_manager (
managerID numeric identity,
userName nvarchar(30) null,
password nvarchar(50) null,
name nvarchar(30) null,
number int null,
isSuperManager bit null,
constraint PK_TB_MANAGER primary key (managerID)
)
go
/*==============================================================*/
/* Table: tb_room */
/*==============================================================*/
create table tb_room (
roomID int not null,
roomNO nvarchar(20) null,
apartmentID numeric null,
holdNums int null,
expenses int null,
phone nvarchar(20) null,
constraint PK_TB_ROOM primary key (roomID)
)
go
/*==============================================================*/
/* Table: tb_student */
/*==============================================================*/
create table tb_student (
studentID numeric identity,
roomID int null,
name nvarchar(30) null,
sex nvarchar(10) null,
nation nvarchar(20) null,
major nvarchar(20) null,
class nvarchar(20) null,
phone nvarchar(20) null,
constraint PK_TB_STUDENT primary key (studentID)
)
go
alter table tb_apartmentmanager
add constraint FK_TB_APART_REFERENCE_TB_MANAG foreign key (managerID)
references tb_manager (managerID)
go
alter table tb_apartmentmanager
add constraint FK_TB_APART_REFERENCE_TB_APART foreign key (apartmentID)
references tb_apartment (apartmentID)
go
alter table tb_chargerecord
add constraint FK_TB_CHARG_REFERENCE_TB_ROOM foreign key (roomID)
references tb_room (roomID)
go
alter table tb_chargerecord
add constraint FK_TB_CHARG_REFERENCE_TB_MANAG foreign key (managerID)
references tb_manager (managerID)
go
alter table tb_room
add constraint FK_TB_ROOM_REFERENCE_TB_APART foreign key (apartmentID)
references tb_apartment (apartmentID)
go
alter table tb_student
add constraint FK_TB_STUDE_REFERENCE_TB_ROOM foreign key (roomID)
references tb_room (roomID)
go
<3>.利用SQL Server Management Studio执行sql文件:
<4>.利用Myeclipse hibernate反向工程生成相应model:
首先进入Myeclipse Database Explorer,
建立相应的数据库连接:
生成相应model:
<5>.Spring和数据源的相关配置:
(跟mysql,oracle的区别只是把hibernate的sql方言改一下就好了)
把生成的model的相关信息注册到sessionFactory
applicationContext.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/context/mvc" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context/mvc http://www.springframework.org/schema/context/mvc/spring-mvc-3.0.xsd">
<!-- 配置数据源 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/datasource-conf.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${driverClass}" />
<property name="jdbcUrl" value="${jdbcUrl}" />
<property name="user" value="${user}" />
<property name="password" value="${password}" />
<property name="initialPoolSize" value="${initialPoolSize}"></property>
<property name="minPoolSize" value="${minPoolSize}"></property>
<property name="maxPoolSize" value="${maxPoolSize}"></property>
<property name="maxIdleTime" value="${maxIdleTime}"></property>
<property name="acquireIncrement" value="${acquireIncrement}"></property>
<property name="idleConnectionTestPeriod" value="${idleConnectionTestPeriod}"></property>
<property name="acquireRetryAttempts" value="${acquireRetryAttempts}"></property>
<property name="breakAfterAcquireFailure" value="${breakAfterAcquireFailure}"></property>
<property name="maxStatements" value="${maxStatements}"></property>
<property name="testConnectionOnCheckout" value="${testConnectionOnCheckout}"></property>
</bean>
<!-- 启动注解自动装配 -->
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
<!-- 启动注解驱动 MVC-->
<context:component-scan base-package="acms.controller">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!--基于注解映射的hibernateTemplate -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>acms.model.Apartment</value>
<value>acms.model.ApartmentManager</value>
<value>acms.model.ChargeRecord</value>
<value>acms.model.Manager</value>
<value>acms.model.Room</value>
<value>acms.model.Student</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- JDBCTemplate -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
datasource-conf.properties内容如下:
driverClass=com.mysql.jdbc.Driver
jdbcUrl=jdbc\:sqlserver\://localhost\:1433;databaseName\=zys_test
testConnectionOnCheckout=false
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true//true只是为了调试起来方便
以后我还会更新博客记录我的课设过程,最后完成之后会上传全部的源代码和大家交流。
好了,今天就写到这里,刚吃完了饭,小睡一会儿~~
分享到:
相关推荐
----------------------- 计算机-数据库课程设计-银行管理系统全文共24页,当前为第1页。 计算机-数据库课程设计-银行管理系统全文共24页,当前为第2页。 计算机-数据库课程设计-银行管理系统全文共24页,当前为第3...
数据库课程设计——英语学习助手, 包括登录、注册、查询、翻译、单词测试、用户收藏本、用户记错本、个人信息板块、收藏与取消收藏、单词增删改、单词例句增删改、数据库备份和数据库恢复功能。
数据库管理功能模块 楼盘房屋信息 客户信息 合同 楼盘房屋客户信息 返回到数据库中 信息更新 合同信息 返回数据库 信息更新 房地产公司售楼管理系统-数据库课程设计全文共5页,当前为第4页。 查询功能 楼盘信息查询...
本次课程设计是用数据库的知识设计一个餐厅点菜系统的过程,可以提高顾客在餐厅点菜的效率,该系统可以记录餐厅的基本信息,使餐厅管理工作规范化,科学化。结合计算机技术,采用eclipse和MySQL开发而成。 设计介绍...
Pleasure Group Office【T985AB-B866SYT-B182C-BS682T-STT18】 Pleasure Group Office【T985AB-B866SYT-B182C-BS682T-STT18】 数据库课程设计实验报告火车票售票管理系统全文共15页,当前为第1页。数据库课程设计...
软件工程与数据库 课程设计 任务书 学院名称: 数学与计算机学院 课程代码:_6014419_ 专 业: 年 级... 数据库课程设计--图书管理系统全文共3页,当前为第2页。 数据库课程设计--图书管理系统全文共3页,当前为第3页。
数据库课程设计 数据库课程设计通常涉及一系列的实践项目,旨在帮助学生掌握数据库系统的基本概念、技术和工具。下面是对数据库课程设计的介绍,包括目标、内容、步骤和总结: 一、课程设计目标 1. 了解数据库的...
耗时长之作图书馆管理系统应该能够提供所有借阅者的详细信息,以及馆内库存的详细情况,对借书和还书两大功能进行合理的操作并登记。图书馆里系统的主要任务是建立详尽的借阅信息,以及馆内的书种及对应书刊的记录,...
2008级数据库课程设计任务书 【设计目的】 数据库课程设计是在学生系统地学习了《数据库系统原理》课程后, 按照关系型数据库的基本远离,综合运用所学的知识,设计开发一个小 型的数据库管理信息系统,通过对一个...
数学与计算机学院 课程设计说明书 课 程 名 称: 软件工程与数据库课程设计 课 程 代 码: 题 目: 民航售票系统 年级/专业/班: 学 生 姓 名: 学 号: 开 始 时 间: 2012 年 6 月 5 日 完 成 时 间: 2012 年 6 月 20 日...
《数据库原理与设计》课程设计 (含完整设计资料) 一、超市管理数据库 超市需建立一个管理数据库存储以下信息: *超市信息包括超市代号,超市名,经理名及超市运营开销。 *一个超市内有多个部门,每个部门有部门号...
数据库课程设计在线银行系统设计及实现转账功能实现,JSP与数据库的链接,日期获取ATM存取款功能实现,登出功能的实现登录与注册功能实现,session跳转个人信息查询功能实现本系统采用了可视化的集成开发环境...
数据库课程设计——健康档案管理系统 数据库 课程设计报告 课 题: 健康档案管理系统 目 录 课程设计的目的和意义…………………………………2 课程设计的目的 …………………………………………2 课程设计的意义 ...
可以完成简单的图书管理,例如:借还书记录,罚款记录等。。。
二、课程设计报告提纲 (1) 课程设计的题目、系统的总体功能描述 (2) 需求分析(概括描述、DFD、DD) (3) 数据库概念结构设计(局部E-R图、基本E-R图) (4) 数据库逻辑结构设计(关系模式—列表形式、存储过程、触发器、...
二、课程设计内容 西安邮电学院计算机系学生成绩管理系统 三、软硬件环境及系统所采用的体系结构 软件环境:Microsoft Visual Studio .NET 2003+ Microsoft Sql Server +Windows 2000 Server 硬件要求: ...
通过网络对该银行储蓄系统项目进行详细调查研究,初拟一个简单的系统实现报告,一方面是为了熟知银行储蓄系统具体的设计实现过程,另一方面是对数据库设计的探索和认识,了解数据库设计的全过程以及会用数据库设计...
数据库课程设计答辩,PPT模板,2011年11月25日。