SQL can be combined with an object-oriented approach. What we end up with is Hibernate Query Language, or HQL. This article discusses how HQL works, and shows how to use it in the real world.Amateurs study generics and professionals study specifics. Until now, I have been discussing the generics of Hibernate. Now, it’s time to understand the specifics. Unless each aspect of Hibernate is understood, it will become really difficult to unleash its full power.
In itself, SQL is very powerful. So when the power of SQL is combined with the flexibility of the object oriented approach, what we get is Hibernate Query Language, or HQL for short. Just like SQL, HQL also provides Projection queries, Aggregation functions, Grouping and Restrictions. Even the most complex queries in SQL can be mapped to HQL.
The first section of this article will detail the usage of HQL on simple queries without any participating relationships. The complexity comes into play when associations occur. In the second section, I will be discussing how to work with HQL in the context of associations. The example in the third section will implement a report using a complex query with a participating relationship. So let’s begin.
This article is taken from the website : http://www.devarticles.com
All Rights Reserved@www.devarticles.com
Click here to download the PDF