-
Couldn't load subscription status.
- Fork 8
Specifying a custom HQL alias
gert-wijns edited this page Sep 12, 2014
·
2 revisions
The entities in a TypeSafeQuery automatically get an HQL alias. It is possible to set them yourself by using query.setHqlAlias(entity, "alias").
Can be used when working in conjunction with another framework which requires specific hql aliases.
Person person = query.from(Person.class);
Town town = person.getTown();
query.setHqlAlias(person, "p");
query.setHqlAlias(town, "t");
=> "from Person p join p.town t"