*数据库最好安装在虚拟机里
*框架Hibernate
mybatis
spring
*步骤二三可反
一.创建项目bms
MVC风格
1.M:model,实体类
2.V: view,jsp,html
3.C:controller,servlet
自底向上开发模式:先建立底层模型(实体类)
二.创建实体类
1.包名:公司域名反过来写
2.属性的数据类型:有的数据不是用来加减乘除的所以要设置成字符串类型
3.
(1)带参构造器:
public Book(int bookId, String bookISBN, String bookName, float bookPrice, String bookAuthor, String bookPublisher,
int bookCount) {
super();
this.bookId = bookId;
this.bookISBN = bookISBN;
this.bookName = bookName;
this.bookPrice = bookPrice;
this.bookAuthor = bookAuthor;
this.bookPublisher = bookPublisher;
this.bookCount = bookCount;
}
(2)无参构造器
public Book() {
super();
}
三.依据实体类创建数据库
1.数据库名称跟项目名称相同即可
2.数据库里存中文,所以字符集选utf8mb4
3.一个实体类对应一张表