public List<Log> findAllLogs() {
Log log=null;
Connection con=null;
Statement stm=null;
ResultSet rs=null;
String sql="select * from wangxuan_log";
try{
con=ConnectionFactory.getConnection();
stm=con.createStatement();
rs=stm.executeQuery(sql);
while(rs.next()){
log=new Log();
log.setId(rs.getInt(1));
log.setLog_title(rs.getString(2));
log.setLog_content(rs.getString(3));
log.setLog_date(rs.getDate(4));
log.setRemark(rs.getString(5));
}
con.commit();
}catch(SQLException e){
e.printStackTrace();
if(con!=null){
try {
con.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}finally{
JdbcUtil.release(con, stm, rs);
}
//return List;
}
这个方法应该返回list类型?我想让返回log,如何做啊?或者把log放到list中也行。