session.createQuery(hql);
Hibernate 中的hql可以有以下几种形式:
1、 from Student //可以忽略select
2、 from Student s //可以加别名
3、 from Student as s //可以用as加别名
4、 select s from Student s //使用select查询对象,必须定义别名
5、 select new Student(id,name) from Student
注意:不支持select * from …之类的hql!!!
Hibernate 中的hql可以有以下几种形式:
1、 from Student //可以忽略select
2、 from Student s //可以加别名
3、 from Student as s //可以用as加别名
4、 select s from Student s //使用select查询对象,必须定义别名
5、 select new Student(id,name) from Student
注意:不支持select * from …之类的hql!!!
本文介绍了Hibernate中HQL查询的基本语法及用法,包括不同类型的查询语句如from和select等,并强调了HQL不支持select *这类通配符查询的特点。
1203

被折叠的 条评论
为什么被折叠?



