SQLite数据库的封装
一:建立实体类对象,字段名一定要和数据库里的一一对应
Book.java
<span style="font-size:14px;">package com.example.entity;
public class Book {
private Integer id;
private String author;
private double price;
private Integer pages;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public Integer getPages() {
return pages;
}
public void setPages(Integer pages) {
this.pages = pages;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Book() {
super();
// TODO Auto-generated constructor stub
}
public Book(Integer id, String author, double price, Integer pages,
String name) {
super();
this.id = id;
this.author = author;
this.price = price;
this.pages = pages;
this.name = name;
}
@Override
public String toString() {
return "Book [id=" + id + ", author=" + author + ", price=" + price
+ ", pag