0% found this document useful (0 votes)
49 views

HQL - 2

HQL supports the main ANSI SQL join types such as inner, left, right, and full outer joins. The Hibernate Query Language also allows associations and collections to be initialized along with their parent objects using a "fetch" join with a single select. This override the outer join and lazy loading declarations defined in the mapping file. The select clause in HQL picks which objects and properties to return in the query result set. Properties of any type including component types can be selected.

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)
49 views

HQL - 2

HQL supports the main ANSI SQL join types such as inner, left, right, and full outer joins. The Hibernate Query Language also allows associations and collections to be initialized along with their parent objects using a "fetch" join with a single select. This override the outer join and lazy loading declarations defined in the mapping file. The select clause in HQL picks which objects and properties to return in the query result set. Properties of any type including component types can be selected.

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

The supported join types are borrowed from ANSI SQL




• (not usually useful)

The , and constructs may be abbreviated.

In addition, a "fetch" join allows associations or collections of values to be initialized along with their parent
objects, using a single select. This is particularly useful in the case of a collection. It effectively overrides the
outer join and lazy declarations of the mapping file for associations and collections. See Section 21.1,
“Fetching strategies” for more information.

The associated objects are not returned directly in the query results. Instead, they may be accessed via the par-
ent object.

It is possible to create a cartesian product by join fetching more than one collection in a query, so take care in
this case. Join fetching multiple collection roles is also disabled for bag mappings. Note also that the
construct may not be used in queries called using . Finally, note that and
are not meaningful.

15.4. The select clause


The clause picks which objects and properties to return in the query result set. Consider:

The query will select s of other s. Actually, you may express this query more compactly as:

You may even select collection elements, using the special function. The following query returns all
kittens of any cat.

Queries may return properties of any value type including properties of component type:

NHibernate 5.2 146

You might also like