检索没有HQL的表的所有行? [英] Retrieving all rows of a table without HQL?

查看:72
本文介绍了检索没有HQL的表的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Hibernate 4,并希望简单列出表格的所有行。我找到的所有解决方案都建议使用from tablename之类的东西,但我希望避免在字符串中硬编码表名。

可以使用

  session.createCriteria(MyEntity.class).list(); 

举例。


I am using Hibernate 4 and would like to simply list all rows of a table. All solutions I found suggest using something like "from tablename", but I would like to avoid hardcoding tablenames in strings.

解决方案

You can use

session.createCriteria(MyEntity.class).list();

for example.

这篇关于检索没有HQL的表的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆