0% found this document useful (0 votes)
33 views1 page

HQL - 3

HQL is the Hibernate Query Language for querying entities and relationships between entities. Some key capabilities of HQL include: 1) The where clause allows you to filter the entities returned by specifying conditions on entity properties or relationships between entities. 2) Compound path expressions in the where clause make it extremely powerful as it can represent joins between entities. 3) Operators can compare properties as well as perform identity comparisons between entities. 4) The id property can be used to reference the unique identifier of an entity and enables queries without requiring table joins in the SQL translation.

Uploaded by

nipam1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

HQL - 3

HQL is the Hibernate Query Language for querying entities and relationships between entities. Some key capabilities of HQL include: 1) The where clause allows you to filter the entities returned by specifying conditions on entity properties or relationships between entities. 2) Compound path expressions in the where clause make it extremely powerful as it can represent joins between entities. 3) Operators can compare properties as well as perform identity comparisons between entities. 4) The id property can be used to reference the unique identifier of an entity and enables queries without requiring table joins in the SQL translation.

Uploaded by

nipam1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

HQL: The Hibernate Query Language

Note that these last two queries will require more than one SQL . This means that the clause
does not correctly order the whole result set.

In order to use non-mapped base classes or interfaces in HQL queries, they have to be imported. See Sec-
tion 5.1.23, “import” for more information.

15.7. The where clause


The clause allows you to narrow the list of instances returned.

returns instances of named 'Fritz'.

will return all instances of for which there exists an instance of with a property equal to the
property of the . Compound path expressions make the clause extremely powerful. Con-
sider:

This query translates to an SQL query with a table (inner) join. If you were to write something like

you would end up with a query that would require four table joins in SQL.

The operator may be used to compare not only properties, but also instances:

The special property (lowercase) may be used to reference the unique identifier of an object. (You may also
use its property name.)

The second query is efficient. No table join is required!

Properties of composite identifiers may also be used. Suppose has a composite identifier consisting of
and .

NHibernate 5.2 148

You might also like