String sql = "select count(*) from t_product";
之后应该怎么放进int num里面
执行这个sql 得到的数量 然后赋值给 num
sql 就是这样写 剩下的就是程序直接接收返回值就行
看你用的是hibernate还是mybatis
hibernate:
String hql = "select count(*) from t_product";
int num((Integer)getHibernateTemplate().iterate(hql).next()).intValue();