【发布时间】:2014-07-08 10:53:08
【问题描述】:
我正在学习 Hibernate,在练习中我必须做这个查询
"SELECT count(id) as numero_utenti, imc
FROM Utenti
WHERE azienda = '" + id + "' GROUP BY imc"
问题是,我不知道如何查看结果并将结果保存在字符串中。
谢谢。
这是函数
public String getStat(int id) {
String stat = "";
int count = 0;
try {
Query query = session.createQuery("SELECT count(id) as numero_utenti, imc FROM Utenti WHERE azienda = '" + id + "' GROUP BY imc");
// as I extract the values?
tx.commit();
} catch (HibernateException he) {
throw he;
}
return stat;
}
【问题讨论】:
-
请正确提问。这是无法理解的。
-
我已经更新了帖子