我是你就会这样写
Session getSession(){..............}
List getTopOne() {
Session s = getSession();
List list session.createQuery("from Room").setMaxResults(1).list();
return list.isEmpty()?null:(Room)list.get(0);
}
void showTopOne() {
Room room = getTopOne();
}
[此贴子已经被作者于2006-9-10 0:09:06编辑过]