in
query = session.createQuery("FROM TdResult where Dbfname='"
+ redf + "' and Recordnum in(select Recordnum from TdResult where "+ keyitem +" and content <> '') group by content order by "+ordf);
转化成
List ls=HibernateSessionFactory.getSession().createQuery("select Recordnum from TdResult where "+ keyitem +" and content <> ''").list();
query = session.createQuery("FROM TdResult where Dbfname='"
+ redf + "' and Recordnum in (:mynum) group by content order by "+ordf).setParameterList("mynum",ls);