O'Reilly logo

Hibernate: A J2EE™ Developer's Guide by Will Iverson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Queries

Hibernate supports a wide variety of options for retrieving objects from a database. These include the Hibernate Query Language (HQL), the Criteria API, and ordinary Structured Query Language (SQL).

In this chapter, we will take a look at each of these three retrieval mechanisms, and conclude with a mechanism for storing HQL and SQL queries directly in your *.hbm.xml mapping files.

HQL

The first thing you should know about HQL is that it is exclusively a query language. Unlike SQL, which offers statements of different forms for SELECT, UPDATE, DELETE, and INSERT, HQL is designed exclusively for retrieval. As a result, the syntax is most similar to the SELECT statement. There is no such thing as HQL for updating or inserting data, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required