Hibernate HQL字符串的写法问题

List apps = (List)getHibernateTemplate()
.find("from [b]Application as a[/b] where a.attend.employee=?" , emp);与
List apps = (List)getHibernateTemplate()
.find("from Application where attend.employee=?" , emp);有区别的?效果是否相同?是否都正确的写法?

再如List pays = (List)getHibernateTemplate()
.find("from Payment[b] as p [/b]where p.employee = ? and p.payMonth = ?" , args);与
List pays = (List)getHibernateTemplate()
.find("from Payment where employee = ? and payMonth = ?" , args);有区别的?效果是否相同?是否都正确的写法?

看hql的语法就知道,这其它都是一样的,就像sql的语法差不多

“as”这只不过是设置一个别名而已

两者一样,其实和SQL一样,当有多个Object时才会使用as,仅仅是为了区分

as 只是作为一个别名

楼主 想多了 .....

好好看看数据库原理