Java Reference
In-Depth Information
SOME is just an alias (or a synonym) for ANY; therefore, it can be used anywhere ANY can
be used.
11.1.5. Joining entities
If you've used relational databases and SQL, you must have some experience with the
JOIN operator. You can use JOIN to create a Cartesian product between two entities.
Normally you provide a WHERE clause to specify the JOIN condition between entities in-
stead of just creating a Cartesian product.
You have to specify the entities in the FROM clause to create a JOIN between two or more
entities. The two entities are joined based on either their relationships or any arbitrary per-
sistence fields. When two entities are joined, you may decide to retrieve results that match
the JOIN conditions. For example, suppose you join Category and Item using the re-
lationships between them and retrieve only entities that match the JOIN condition. Such
joins are known as inner joins. Conversely, suppose you need to retrieve results that satisfy
the JOIN conditions but also include entities from one side of the domain that don't have
matching entities on the other side. For example, you may want to retrieve all instances of
Category even if there's no matching instance of Item . This type of join is called an
outer join. Note that an outer join can be left, right, or both.
Let's first look at some examples of the most common types of joins: inner joins and outer
joins. After this, we'll look at the less-commonly used (though sometimes useful) fetch and
theta joins.
Inner joins
A common situation in applications is the need to join two or more entities based on
something shared in their relationship. Here's the syntax for INNER JOIN :
[INNER] JOIN join_association_path_expression [AS]
identification_variable
In ActionBazaar, Category and User entities have a many-to-one association. To re-
trieve all users who match a specific criterion, you could try this query:
Search WWH ::




Custom Search