hql的几种常见形式

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)