Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
db-use-join
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > Metadata Extension Reference > db-use-join

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

Sets the type of join used to fetch a referenced instance. This extension can be used in different contexts but the possible values remain the same.

db-use-join and db-use-key-join

Description

no

Do not join to retrieve the fields

outer

Use an outer join to retrieve fields

inner

Use an inner join to retrieve fields. Using an inner join allows the join to extend further across the object graph as other joins can be done from the joined table. However rows will be lost if the reference contains null or the database referential integrity is invalid.

Setting db-use-join on a class

The db-use-join value set on a class is the default db-use-join value for all fields that reference the class. If the model has a Person class with an Address field and the db-use-join is set to "outer" on the Address field; then an outer join will be used to retrieve the Address fields whenever Person is read. This will work even if the Address on Person is null. If an inner join is used and the Address is null then an exception might be thrown or worse the rows will be silently dropped from the result. Using an inner join has the advantage that more joins may be done from Address to instances it referenced (e.g. Country).

Copy Code
<class name="Address">
    <extension key="db-use-join" value="outer" />
</class>
Setting db-use-join on a field

The db-use-join value set on a field is used instead of the db-use-join value from the referenced class. This also becomes the default value for any fetch groups that include the field (see Fetch Groups).

Copy Code
<field name="address">
    <extension key="db-use-join" value="no" />
</field>
Setting db-use-join on a collection, array or map field

The db-use-join extension can be set on a collection, array and map field storing persistent class values. The default join used in this case is "inner". The db-use-key-join extension behaves in the same way for maps with persistent class keys.