我想实现我的第一个休眠的SQL查询休眠sql查询
public List<Subjectgrouplist> getSubjectgroups() {
return hibernateTemplate.find("from subjectgrouplist where id > 0");
}
我试图返回所有表。我知道where子句不合适,但我仍然试用过。有人能告诉我如何构建查询吗?
我的目标是在jsp中用foreach-tag打印列表。
我想实现我的第一个休眠的SQL查询休眠sql查询
public List<Subjectgrouplist> getSubjectgroups() {
return hibernateTemplate.find("from subjectgrouplist where id > 0");
}
我试图返回所有表。我知道where子句不合适,但我仍然试用过。有人能告诉我如何构建查询吗?
我的目标是在jsp中用foreach-tag打印列表。
试试这个:
public List<Subjectgrouplist> getSubjectgroups() {
return hibernateTemplate.find("from SubjectGroup x where x.id > 0");
}
检查http://stackoverflow.com/questions/1304965/how-can-i-replicate-show-tables-in-hibernate和http://stackoverflow.com/问题/ 4813122/get-all-table-names-set-up-in-sessionfactory – FrEaKmAn
为了上帝的缘故,如何阅读文档?它在这里:http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#queryhql,第一段谈到区分大小写。 –