Top Description Methods
org.jooq

public Interface ForeignKey<R extends org.jooq.Record, O extends org.jooq.Record>

extends Key<R extends Record>
Known Direct Implementers
org.jooq.impl.ReferenceImpl
Annotations
@SuppressWarnings:unchecked
Type Parameters
<R>
The FOREIGN KEY's owner table record
<O>
The referenced KEY's owner table record
Imports
java.util.Collection, .List, org.jooq.exception.DataAccessException, org.jetbrains.annotations.Blocking, .NotNull, .Nullable

A ForeignKey is an object referencing a UniqueKey. It represents a FOREIGN KEY relationship between two tables.

Instances of this type cannot be created directly. They are available from generated code.

Author
Lukas Eder

Method Summary

Modifier and TypeMethod and Description
public @NotNull Table<R>
children(O record)

Get a table expression representing the children of a record, given this foreign key.

public @NotNull Table<R>
children(O... records)

Get a table expression representing the children of a record, given this foreign key.

public @NotNull Table<R>
children(Collection<? extends O> records)

Get a table expression representing the children of a record, given this foreign key.

public @NotNull Result<R>
fetchChildren(O record)

Fetch child records of a given record through this foreign key

This returns childs record referencing a given record through this foreign key, as if fetching from children(Record).

public @NotNull Result<R>
fetchChildren(O... records)

Fetch child records of a given set of records through this foreign key

This returns childs record referencing any record in a given set of records through this foreign key, as if fetching from children(Record...).

public @NotNull Result<R>
fetchChildren(Collection<? extends O> records)

Fetch child records of a given set of records through this foreign key

This returns childs record referencing any record in a given set of records through this foreign key, as if fetching from children(Collection).

public O
fetchParent(R record)

Fetch a parent record of a given record through this foreign key

This returns a parent record referenced by a given record through this foreign key, as if fetching from parent(Record).

public @NotNull Result<O>
fetchParents(R... records)

Fetch parent records of a given set of record through this foreign key

This returns parent records referenced by any record in a given set of records through this foreign key, as if fetching from parents(Record...).

public @NotNull Result<O>
fetchParents(Collection<? extends R> records)

Fetch parent records of a given set of record through this foreign key

This returns parent records referenced by any record in a given set of records through this foreign key, as if fetching from parents(Collection).

public @NotNull UniqueKey<O>
getKey()

The referenced UniqueKey.

public @NotNull List<TableField<O, ?>>
getKeyFields()

The fields that make up the referenced UniqueKey.

public @NotNull @NotNull TableField<O, ?>[]
getKeyFieldsArray()

Deprecated as a consequence of TableField being deprecated.
The fields that make up the referenced UniqueKey.
public @NotNull Table<O>
parent(R record)

Get a table expression representing the parent of a record, given this foreign key.

public @NotNull Table<O>
parents(R... records)

Get a table expression representing the parents of a record, given this foreign key.

public @NotNull Table<O>
parents(Collection<? extends R> records)

Get a table expression representing the parents of a record, given this foreign key.

Inherited from org.jooq.Key:
constraintenforcedgetFieldsgetFieldsArraygetTablenullable

Method Detail

childrenback to summary
public @NotNull Table<R> children(O record)

Get a table expression representing the children of a record, given this foreign key.

Annotations
@NotNull
childrenback to summary
public @NotNull Table<R> children(O... records)

Get a table expression representing the children of a record, given this foreign key.

Annotations
@NotNull
childrenback to summary
public @NotNull Table<R> children(Collection<? extends O> records)

Get a table expression representing the children of a record, given this foreign key.

Annotations
@NotNull
fetchChildrenback to summary
public @NotNull Result<R> fetchChildren(O record) throws DataAccessException

Fetch child records of a given record through this foreign key

This returns childs record referencing a given record through this foreign key, as if fetching from children(Record).

Annotations
@NotNull
@Blocking
Exceptions
DataAccessException:
if something went wrong executing the query
See Also
UpdatableRecord#fetchChild(ForeignKey), UpdatableRecord#fetchChildren(ForeignKey)
fetchChildrenback to summary
public @NotNull Result<R> fetchChildren(O... records) throws DataAccessException

Fetch child records of a given set of records through this foreign key

This returns childs record referencing any record in a given set of records through this foreign key, as if fetching from children(Record...).

Annotations
@NotNull
@Blocking
Exceptions
DataAccessException:
if something went wrong executing the query
See Also
UpdatableRecord#fetchChild(ForeignKey), UpdatableRecord#fetchChildren(ForeignKey)
fetchChildrenback to summary
public @NotNull Result<R> fetchChildren(Collection<? extends O> records) throws DataAccessException

Fetch child records of a given set of records through this foreign key

This returns childs record referencing any record in a given set of records through this foreign key, as if fetching from children(Collection).

Annotations
@NotNull
@Blocking
Exceptions
DataAccessException:
if something went wrong executing the query
See Also
UpdatableRecord#fetchChild(ForeignKey), UpdatableRecord#fetchChildren(ForeignKey)
fetchParentback to summary
public O fetchParent(R record) throws DataAccessException

Fetch a parent record of a given record through this foreign key

This returns a parent record referenced by a given record through this foreign key, as if fetching from parent(Record). If no parent record was found, this returns null

Annotations
@Nullable
@Blocking
Exceptions
DataAccessException:
if something went wrong executing the query
See Also
TableRecord#fetchParent(ForeignKey)
fetchParentsback to summary
public @NotNull Result<O> fetchParents(R... records) throws DataAccessException

Fetch parent records of a given set of record through this foreign key

This returns parent records referenced by any record in a given set of records through this foreign key, as if fetching from parents(Record...).

Annotations
@NotNull
@Blocking
Exceptions
DataAccessException:
if something went wrong executing the query
See Also
TableRecord#fetchParent(ForeignKey)
fetchParentsback to summary
public @NotNull Result<O> fetchParents(Collection<? extends R> records) throws DataAccessException

Fetch parent records of a given set of record through this foreign key

This returns parent records referenced by any record in a given set of records through this foreign key, as if fetching from parents(Collection).

Annotations
@NotNull
@Blocking
Exceptions
DataAccessException:
if something went wrong executing the query
See Also
TableRecord#fetchParent(ForeignKey)
getKeyback to summary
public @NotNull UniqueKey<O> getKey()

The referenced UniqueKey.

Annotations
@NotNull
getKeyFieldsback to summary
public @NotNull List<TableField<O, ?>> getKeyFields()

The fields that make up the referenced UniqueKey.

This returns the order in which the fields of getKey() are referenced, which is usually the same as the fields of UniqueKey#getFields(), but not necessarily so.

Annotations
@NotNull
getKeyFieldsArrayback to summary
public @NotNull @NotNull TableField<O, ?>[] getKeyFieldsArray()

Deprecated

as a consequence of TableField being deprecated. See corresponding docs for further information.

The fields that make up the referenced UniqueKey.

This returns the order in which the fields of getKey() are referenced, which is usually the same as the fields of UniqueKey#getFieldsArray(), but not necessarily so.

Annotations
@NotNull
See Also
getKeyFields()
parentback to summary
public @NotNull Table<O> parent(R record)

Get a table expression representing the parent of a record, given this foreign key.

Annotations
@NotNull
parentsback to summary
public @NotNull Table<O> parents(R... records)

Get a table expression representing the parents of a record, given this foreign key.

Annotations
@NotNull
parentsback to summary
public @NotNull Table<O> parents(Collection<? extends R> records)

Get a table expression representing the parents of a record, given this foreign key.

Annotations
@NotNull