Reputation: 19569
I have a Dao layer, the entity name is long and ugly.
so, I wander if there is a way to use another name for the class name in HQL
I'm using xml config style.
It's a legacy project.
Upvotes: 0
Views: 81
Reputation: 43087
You can use the entity-name
attribute:
<hibernate mapping>
<class name="package.UglyName" entiy-name="BetterName" table="table1">
...
</hibernate mapping>
And then on the query the entity name can be used instead of the class name:
Session session = SessionFactory.openSession();
List table1List = session.createQuery("FROM BetterName").list();
Upvotes: 2