日期:2014-05-17 浏览次数:20670 次
public List fingAll(){
List list = new ArrayList();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Session session = HibernateSessionFactory.getSession();
Transaction tx = session.beginTransaction();
conn = session.connection();
String queryString = "select name,database,sql,unit from kpi_name where isstart = '1' order by to_number(ID)";
try {
stmt = conn.createStatement();
rs = stmt.executeQuery(queryString);
while (rs.next()) {
String tagname = rs.getString("name");
String databasetype = rs.getString("database");
String sql = rs.getString("sql");
String unit = rs.getString("unit");
Name name = new Name(tagname, databasetype, sql, unit);
list.add(name );
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
close(rs, stmt, conn);
if (session != null) {
HibernateSessionFactory.closeSession();
}
}
return list;
}