product (merchandise) is a member variable of a javabean, class that contains another Javabean, that is, category (commodity category), but my database product table stores cid (identification of commodity category) rather than commodity category. In the background dao layer asked for data from the database when using the beanlisthandler object, it can still be encapsulated into a complete product object, may I ask why?
related codes
/ /
product class
private String pid;
private String pname;
private double market_price;
private double shop_price;
private String pimage;
private Date pdate;
private int is_hot;
private String pdesc;
private int pflag;
private Category category;
category class
private String cid;
private String cname;
dao layer code
public List<Product> findHotProductList() throws SQLException {
QueryRunner runner=new QueryRunner(DataSourceUtils.getDataSource());
String sql="select * from product where is_hot =? limit ?,?";
return runner.query(sql, new BeanListHandler<Product>(Product.class), 1,0,9);
}
this is my product table