packagecn.edu.cg.dao;importjava.sql.Connection;importjava.sql.PreparedStatement;importjava.sql.ResultSet;importjava.util.ArrayList;importjava.util.List;importcn.edu.cg.domain.Book;importcn.edu.cg.utils.JdbcUtils;public classBookDaoImpl {publicBook find(String id) {
Book book=null;
Connection conn=null;
PreparedStatement ps=null;
ResultSet rs=null;try{
conn=JdbcUtils.getConn();
String FINDBYID= "SELECT * FROM book WHERE id=?";
ps=conn.prepareStatement(FINDBYID);
ps.setString(1, id);
rs=ps.executeQuery();
book=newBook();if(rs.next()) {
book.setId(rs.getString("id"));
book.setName(rs.getString("name"));
book.setPrice(rs.getDouble("price"));
}returnbook;
}catch(Exception e) {throw newRuntimeException(e);
}finally{