Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
The AS clause can be used to assign aliases to the classes in your HQL queries, specially when you have long queries. For instance, our previous simple example would be the following:

String hql ="FROM Employee AS E";
Query query =session.createQuery(hql);
List results =query.list();

The AS keyword is optional and you can also specify the alias directly after the class name, as follows:

String hql ="FROM Employee E";
Query query =session.createQuery(hql);
List results =query.list();
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com