2.10.1.3. Embeddable Traversal
Similar to relation traversal, nested embeddable objects can be traversed using Java-like syntax.
For example, if the Company class has a field named "address" of an embeddable type Address, and the Address has a field named "geocode" of an embeddable type Geocode, the geocode of a company’s address can be queried as follows:
SELECT c.address.geocode FROM Company c WHERE c.name = 'Random House'
|
|
The |
Traversal into embeddable’s state field is also allowed as shown in the following query:
SELECT c.address.geocode.latitude FROM Company c WHERE c.name = 'Random House'
Embeddable objects may contain single-valued or collection-valued relations.
These relations can also be traversed using Java-like syntax.
For example, if the Address has a relation field named "phoneLists" of an entity type PhoneNumber, the following query returns the PhoneNumber entities of the Company named 'Random House':
SELECT p FROM Company c, IN(c.address.phoneLists) p WHERE c.name = 'Random House'