在bookbeak中添加:localdate
public void createBook(BeanBook b) throws BaseException{
if(b.getBarcode()==null || \.equals(b.getBarcode()) || throw new BusinessException(\条码必须是1-20个字\); }
if(b.getBookname()==null || \.equals(b.getBookname()) || throw new BusinessException(\图书名称必须是1-50个字\); }
Connection conn=null; try {
conn=DBUtil.getConnection();
b.getBarcode().length()>20){
b.getBookname().length()>50){
String sql=\; java.sql.PreparedStatement pst=conn.prepareStatement(sql); pst.setString(1, b.getBarcode());
java.sql.ResultSet rs=pst.executeQuery();
if(rs.next()) throw new BusinessException(\条码已经被占用\); rs.close(); pst.close(); sql=\
BeanBook(barcode,bookname,pubid,price,state,localdate) values(?,?,?,?,'在库',?)\; pst=conn.prepareStatement(sql);
}
finally{ } }
if(conn!=null)
try { }
conn.close();
// TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { pst.setString(1, b.getBarcode()); pst.setString(2, b.getBookname()); pst.setString(3, b.getPubid()); pst.setDouble(4, b.getPrice()); pst.setTimestamp(5, new pst.execute(); pst.close();
e.printStackTrace(); throw new DbException(e);
java.sql.Timestamp(System.currentTimeMillis()));
} catch (SQLException e) {